You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Daniel Spors edited this page Nov 11, 2020
·
2 revisions
The Scavix WebFramework contains a built in routing mechanism that best work with apaches mod_rewrite, but will also do it's job without.
The basic concept is, that you define a controller class that contains methods, which are 'addressable' from the browser. You may use the buildQuery function to create URLs that are qualified for your installation.
Sample:
buildQuery('home','index',['message'=>'Hi']);
This will result in:
http://your.domain/index.php?wdf_route=home/index&message=Hi
or with mod_rewrite enabled:
http://your.domain/home/index?message=Hi
If you open such an URL in your browser, the Home controller will be created an it's method Index will be invoked.
class Home extends HtmlPage
{
/** * @attribute[RequestParam('message','string',false)] */functionIndex($message)
{
$this->content("Message: $message");
}
}
Notice the DocComment? This is a feature called Attribution and it is used to easily parse arguments from the request to method arguments. WDF supports a set of attributes used for different purposes.