Url Creation Doesn't Work Inside A Module



inside a module view file outputs nothing. Why is that so? Do I need to tell the module anything specific about this and how?

Thank you!

Ok, it seems I need to put


in front of the function to have something displayed. But what’s displayed is URL in form of string, not actual HTML link (


) tag.

Is this normal? I just tested it on the main site (root) level to exclude the usage of a module but it’s still the same.

Any advice?


<a href="<? echo $this->createUrl(‘controller/action’) ?>">your link</a>

<? echo CHtml::link('your link, ‘controller/action’) ?>

Yes, I just figured out myself I needed to use CHtml::link() instead to get the full a tag. Using plain HTML <a href=""></a> wasn’t what i wanted to use.

Thanks anyway.

So the final code looks like:

<?php echo CHtml::link('Manage Entries', Yii::app()->createUrl('entry/list')); ?>

However, since it’s used inside a module named “dashboard” it should output module name as well but it doesn’t. It currently outputs (note that I’m using this rule: ‘entries’ => ‘entry/list’):


whereas I’d like it to be:


Do I have to hardcode module name or I can call it somehow? I couldn’t find answer anywhere. Thanks!

AFAR you can do <?php echo CHtml::link(‘Manage Entries’, array(‘entry/list’)); ?>

‘dashboard/entries’ => ‘entry/list’

or ‘dashboard/entries’ => ‘dashboard/entry/list’ if you want this rule work outside the module

Related to the bold above:

I tried that first, of course, but it doesn’t resolve in accordance with my rule, that is, it is showing “entry/list” instead of “entries” in my link.

Also, I was afraid I would have to put module name into the configuration (routing rules). However, by doing so I’ll be able to use createUrl() function within CHtml::link() AND have module name in the link.