Routing

From EQdkp Plus
Jump to: navigation, search

With EQdkp Plus 2.0, we introduced a new Routing System for Frontend Pages. Registering this Routes and Building Links are done by the Routing Class. A Route maps an URL to a Pageobject.

Methods

addRoute

$this->routing->addRoute($strRoutename, $strPageObject, $strPageObjectPath);
//Example:
$this->routing->addRoute('ViewApplication', 'viewrequest', 'plugins/guildrequest/page_objects');

This Maps the URL "ViewApplication" to the Pageobject "viewrequest" in folder "plugins/guildrequest/page_objects".

getRoutes

$this->routing->getRoutes();

Returns an Array with all Routes.

staticRoute

$string = $this->routing->staticRoute($strPath, $blnWithAlias=false);

Returns the PageObject-String that belongs to the $strPath, returns false if there is no mapped Pageobject. If $blnWithAlias is set true, the returned string is $strPath.

get

$this->routing->get($strPageObject, $blnWithAlias=false);

This will get the whole URL to an $strPageObject. It also considers permissions.

Better use build() method.

getPageObjects

$this->routing->getPageObjects($blnIncludeStatic = false);

This will return an Array of all available PageObjects in Folder "core/pageobjects/".

build

$string = $this->routing->build($strPageObject, $strParamText=false, $strParam=false, $blnAddSID=true, $blnControllerPathPlain = false, $blnAddExtension=true);
  • $strPageObject : string;
  • $strParamText : string; Example: "Testuser"
  • $strParam : string/integer; Example: "u175"
  • $blnAddSID : boolean; Adds SID to end of path
  • $blnControllerPathPlain : boolean; Adds $this->controller_path_plain instead of $this->controller_path
  • $blnAddExtension : Adds the Extension

Example:

$string = $this->routing->build('user', 'admin', 'u1');
//Will result in: /index.php/user/admin-u1.html?s=

simpleBuild

$string = $this->routing->simpleBuild($strPageObject);
//Example:
$string = $this->routing->simpleBuild('raid');

Builds a simple URL until $strPageObject, but without an Extension. Example Output: "index.php/Raid/"

getSeoExtension

$string = $this->routing->getSeoExtension();

Returns the SEO Extension, depending from the Settings.

  • .html
  • .php
  • /

clean

$string = $this->routing->clean($strText);

Removes special chars from $strText. Can be used for Building URLs.

getPageObject

$this->routing->getPageObject($strObjectName);

Returns an Object with the Pageobject. Returns false if $strObjectName cannot be loaded.