curlyiirulesyii-componentsyii1.x

How to get URL from the controller and action name (that follows rules from CUrlManager)?


I am currently working on the Yii 1.1 project and I am creating cron command for the sitemap manager. In the main config, I configured URL manager rules (ex. 'home' => 'home/index', where "home" is controller name, and "index" is the action from the controller, and home is the url path - example.com/home). I've got extracted all 'controllers and actions of the published pages, but in rules list, there are some rules that are making dynamic URL (for ex. gallery/<:id> => 'gallery/view'). I saw there are some functions in Yii2, but in Yii 1.1 I can not find any way to get real URL from CUrlManager by rules (by controller and action name).

Thank you in advance!


Solution

  • // Yii 1.1:    
    $url = Yii::app()->createUrl('gallery/view', ['id'=>$id]);