on_uri_definition_init

Navigation:  Development > Function Reference > Common Callbacks >

on_uri_definition_init

Previous pageReturn to chapter overviewNext page

Execute when system prepare the URI Manager definition. We can overwrite existing role by returning new value.

 

class Development_Callbacks extends appRain_Base_Modules_Callbacks
{
    public function on_uri_definition_init($def = NULL)
    {
 
    }
}

 

System overwrite existing URI manager definition if we return value from this function. See below example:

 

class Development_Callbacks extends appRain_Base_Modules_Callbacks
{
    public function on_uri_definition_init($def = NULL)
    {
        /*
         * Example 1
         * This example moves control to
         * home/index for the url www.example.com/hellow-world
         */
        $def['pagerouter'][] = array(
            "actual"=>Array("home","index"),
            "virtual"=>Array("hello-world1")
        );
 
        /*
         * Example 2
         * This example moves control to
         * home/index/5 for the url www.example.com/birthday-gift/15th-birthday
         */
        $def['pagerouter'][] = array(
            "actual"=>Array("home","index","5"),
            "virtual"=>Array("birthday-gift","15th-birthday")
        `);
 
        /*
         * For any new chnage we have to return $def
         */
        return $def;
    }
}