2016-11-04 36 views
0

我有以下代碼:如何提示yii 1中的鏈接?

return array(
     ULogt::UPDATE => ' 

<div>  
    <a href="#link">Navigate</a> 
</div> 
' 

此代碼地處類稱爲links.php。 我需要導航到('viewform', array('model'=>$this->loadJson($id)),當用戶按下導航按鈕。我不知道如何插入此代碼而不是#link。我該怎麼做?

回答

1
CHtml::link( 
    "Navigate", 
    "javascript:void(0);", // link for destination or you can handle same with jQuery 
    array(
    'id' => 'navigation-id', // id for handeling in jQuery 
    'key' => $data, // Required data will be appeared as attributes for this link 
    ) 
); 

您可以像

Yii::app()->createUrl(
     '/profile/membership/view', // your link 
     array(
      'id'=> 1 // data to be sent 
     ) 
) 

Check for URL formating

創建鏈接