I need to create URLs in Yii with specifying a div on the page to focus when clicked... I know I need to put the div name with #
in the URL, but how do I specify that in createUrl function of Yii...
The createUrl()
function only provides options for parameters, not for elements...as per my knowledge.
If you check createUrl:
additional GET parameters (name=>value). Both the name and value will be URL-encoded. If the name is '#', the corresponding value will be treated as an anchor and will be appended at the end of the URL.
You can add it like this:
echo $this->createUrl('controller/action',array('#'=>'name'));