I am using Yii Version 1.1.15.
In a View I use ajaxlink and it works like a charme:
<?=
CHtml::ajaxLink(
'[Help]',
$this->createUrl('genearal/help'),
array(
'onclick' => '$("#help").dialog("open"); return false;',
'update' => '#help'),
array('id' => 'showHelp')
);
?>
<div id="help"></div>
Since I have a lot of ajaxlink-calls, I want to write a function in the components-folder which I can call with: MyComponents::help("Help", "general/help", "help", "showHelp");
class MyComponents {
public static function help($headline, $controller_and_action, $divname, $idname) {
CHtml::ajaxLink(
'[$headline]',
$this->createUrl('$controller_and_action'),
array(
'onclick' => '$("$divname").dialog("open"); return false;',
'update' => '$divname'),
array('id' => '$idname')
);
}
}
Problem: If I call this in the browser, I only get an empty page.
Do I have to extend MyComponents with a parentclass? Which? (I don't think so: I tested echo CHtml::encode("test") without problems.
Maybe something wrong with my quotes?
I was googeling for hours and gave up. Hope it's not impossible.