UAP 4 Documentation - SystemRouting

Welcome to UAP Docs - SystemRouting

System Routing


What is System Routing?

System Routing uses the URL to search for the page the visitor is requesting.

How does System Routing work?

When a user types in a url, the router checks to see if there is a route set for that url. If there is a match, the system will then check to see if the Controller file exists. Then the router will check to see if the Method exist within that Controller.

How does the Admin add, remove, or edit routes?

This process is simple thanks to the UAP AutoRouter. Login as an Administrator then navigate to the Admin Panel. Click on System Routes. Every time an admin opens this page it will automaticly check for new Controllers and New methods within the Controllers folder. It also checks all the Plugins Controller folders. Use caution when changing the URL Name, for it does not update any links within your site.

Controller : Controller File name without the .php.

Method : Method name within the given Controller file.

URL Name : http://www.userapplepie.com/URLName

Arguments : (:any)(:num)(:all) Used to request or subit more data to given URL http://www.userapplepie.com/ViewProfile/Username

Enabled : Lets system know if route is enabled or not. If disabled user gets error for that URL.

How do arguments work?

In UAP routing the arguments allow the system to do more than just show a page. For example when a visitor wants to view another user's profile, they go to http://www.userapplepie.com/ViewProfile/Username. The router sees that it can use any string to load within the ViewProfile method.

ViewProfile method within the Members Controller:
/**
 * Get profile by username
 * @param $username
 */
public function viewProfile($argument)
{
	echo $argument;
}
The argument (:any) in the above example allows us to echo the Username assigned by url.

Multiple arguments may be used, for example:
(:any)/(:any)/(:any)/(:any)
/**
 * Get profile by username
 * @param $username
 */
public function viewProfile($argument, $argument2, $argument3, $argument4)
{
	echo $argument;
	echo $argument2;
	echo $argument3;
	echo $argument4;
}
Make sure you use the forward slash between the arguments like shown above.

What are the different types of arguments?

(:any) : Allows Characters and Integers
(:num) : Allows only Integers
(:all) : Allows Symbols, Characters and Integers

- Can't find what your looking for? Please use Forum.

UAP 4 Documentation - SystemRouting

Title
Statistics
Last Reply
Forum Permissions
You cannot post in this forum.
You cannot moderate this forum.
You cannot administrate this forum.