pclib  2.3.2
Lightweight PHP framework
PClib route

Route specify "path" to controller's action and can be used instead of plain href attribute.

Each route is translated to common url by function $app->geturl($route). Syntax of the route is similar to directory path. Basic syntax is "controller/action/parameters" which means:

Do "action" with "parameters" in application controller "controller". The purpose of routes is create clean, logical application structure and simple, easy and consistent way to navigate on this structure.

Examples:

For redirecting in your source code you can use function $app->redirect() Example:

$app->redirect("companies/edit/id:$id");

You can use routes in any template when you are creating link or button or even instead of form "action". Just use attribute "route" instead of "href". Examples:

<?elements
link productlist lb "List of products" route "products/list"
button edit lb "Edit product" route "products/edit/id:{ID}"
form route "products/{GET}"
?>

In template, you can use any template value as part of route - usually {ID}, {COMPANY_ID} or so.

Also you can put some additional variables into route with syntax "/variable:value". Examples:

It's possible pass GET variables through route. Just add to the end of the route "/{GET}" for passing all GET variables or "/variable:{GET.variable}" for passing particular variable. Ex: route "products/edit/id:{GET.id}"