PHP Класс Controller_PatternRouter, atk4

in Frontend: $r = $this->add("Controller_PatternRouter") ->addRule("(news\/.*)", "news_item", array("u")) ->route(); if REQUEST_URI is "/news/some-name-of-your-news/", then router would: 1) set $this->app->page to "news_item" 2) set $_GET["u"] to "news/some-name-of-your-news/" uri. Authors: [email protected], [email protected].
Наследование: extends AbstractController
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$app App_Web

Защищенные свойства (Protected)

Свойство Тип Описание
$links array
$rules array

Открытые методы

Метод Описание
addRule ( $regex, $target = null, $params = null ) Add new rule to the pattern router. If $regexp is matched, then page is changed to $target and arguments returned by preg_match are stored inside GET as per supplied params array.
buildURL ( $junk, $url )
init ( ) }}}
link ( $page, $args = [] ) Link method creates a bi-directional link between a URL and a page along with some GET parameters. This method is entirely tranpsarent and can be added for pages which are already developed at any time.
route ( ) Perform the necessary changes in the APP's page. After this you can still get the orginal page in app->page_orig.
setModel ( $model ) Allows use of models. Define a model with fields: - rule - target - params (comma separated).
url ( )

Описание методов

addRule() публичный Метод

Add new rule to the pattern router. If $regexp is matched, then page is changed to $target and arguments returned by preg_match are stored inside GET as per supplied params array.
public addRule ( $regex, $target = null, $params = null )

buildURL() публичный Метод

public buildURL ( $junk, $url )

init() публичный Метод

}}}
public init ( )

route() публичный Метод

Perform the necessary changes in the APP's page. After this you can still get the orginal page in app->page_orig.
public route ( )

setModel() публичный Метод

and content of that model will be used to auto-fill routing
public setModel ( $model )

url() публичный Метод

public url ( )

Описание свойств

$app публичное свойство

public App_Web $app
Результат App_Web

$rules защищенное свойство

protected array $rules
Результат array