Gunnit
Gunnit

Reputation: 1074

how to create a link to a module in yii ?

Hello and thanks for reading.

I was wondering how i can link to a file from my main site to a module

eg ; if i am in protected/views on a file and i want to link to protected/modules/user/profile where i call an action.

Now i get an error that states that action user does not exists.

How can i create a link to a module following the following yii sintax ;

<?php echo CHtml::link('Link Text',array('link to module',
                                 'param1'=>'value1')); ?> 

Upvotes: 0

Views: 2035

Answers (3)

Matt
Matt

Reputation: 2420

this may help with combining CHtml::link with a link to a module and it's controller/action combination:

echo CHtml::link("click here", 
    Yii::app()->createurl('/module/controller/action', array(
        'id' => $model->id // Params
    ))
);

Upvotes: 1

msoa
msoa

Reputation: 1349

<?php echo CHtml::link(Yii::app()->createurl('Module/Controller/Action'),array(
'param1'=>'value1')); ?> 

Upvotes: 4

Gunnit
Gunnit

Reputation: 1074

i managed to figure it out i tried to put this and it works ''/user/profile'' anybody has other ideas let me know

Upvotes: 0

Related Questions