本文整理汇总了PHP中Javelin::onload方法的典型用法代码示例。如果您正苦于以下问题:PHP Javelin::onload方法的具体用法?PHP Javelin::onload怎么用?PHP Javelin::onload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Javelin
的用法示例。
在下文中一共展示了Javelin::onload方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderHTMLFooter
public static function renderHTMLFooter()
{
$javelin = self::getInstance();
$data = array();
if ($javelin->metadata) {
$data[] = 'JX.Stratcom.mergeData(' . json_encode($javelin->metadata) . ');';
$javelin->metadata = array();
}
if ($javelin->behavior) {
$behavior = json_encode($javelin->behavior);
Javelin::onload('JX.initBehaviors(' . $behavior . ')');
$javelin->behavior = array();
}
if ($javelin->onload) {
foreach ($javelin->onload as $func) {
$data[] = 'JX.onload(' . $func . ');';
}
}
$javelin->dirty = false;
if ($data) {
$data = implode("\n", $data);
return '<script type="text/javascript">//<![CDATA[' . "\n" . $data . '//]]></script>';
} else {
return '';
}
}
示例2: renderHTMLFooter
public static function renderHTMLFooter()
{
$javelin = self::getInstance();
$data = array();
if ($javelin->metadata) {
$json_metadata = json_encode($javelin->metadata);
$javelin->metadata = array();
} else {
$json_metadata = '{}';
}
// Even if there is no metadata on the page, Javelin uses the mergeData()
// call to start dispatching the event queue.
$data[] = 'JX.Stratcom.mergeData(' . $javelin->block . ', ' . $json_metadata . ');';
if ($javelin->behavior) {
$behavior = json_encode($javelin->behavior);
Javelin::onload('JX.initBehaviors(' . $behavior . ')');
$javelin->behavior = array();
}
if ($javelin->onload) {
foreach ($javelin->onload as $func) {
$data[] = 'JX.onload(' . $func . ');';
}
}
$javelin->dirty = false;
if ($data) {
$data = implode("\n", $data);
return '<script type="text/javascript">//<![CDATA[' . "\n" . $data . '//]]></script>';
} else {
return '';
}
}