本文整理汇总了PHP中AppHelper::afterRender方法的典型用法代码示例。如果您正苦于以下问题:PHP AppHelper::afterRender方法的具体用法?PHP AppHelper::afterRender怎么用?PHP AppHelper::afterRender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppHelper
的用法示例。
在下文中一共展示了AppHelper::afterRender方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterRender
/**
* afterRender
*
* @return void
* @access public
*/
function afterRender()
{
parent::afterRender();
// コンテンツをフックする
$this->_content = ob_get_contents();
}
示例2: afterRender
/**
* use the callback of afterRender to inject all JS
* this triggers AFTER the view, but BEFORE the layout
* so if you need to customize $this->pathToJs, do so in the view
* or you can pass in as settings
* via Html->scriptBlock()
*/
public function afterRender($viewFile = null)
{
$content = parent::afterRender($viewFile);
if (!empty($this->js)) {
$content .= $this->Html->css($this->pathToCss, null, array('inline' => false));
//$content .= $this->Html->script( $this->pathToJs, array('inline' => false) );
$this->Html->scriptBlock('jQuery(function() { ' . $this->js . '});', array('inline' => false));
}
return $content;
}
示例3: afterRender
/**
* Callback
*
* @access public
*/
public function afterRender()
{
if (!$this->enabled) {
return;
}
parent::afterRender();
$isDebug = (bool) Configure::read();
if (empty($this->params['isAjax']) && empty($this->params['requested'])) {
if (!empty($this->_uses)) {
$uses = array();
foreach ($this->_uses as $file) {
if (isset($this->fileMap[$file])) {
if (is_array($this->fileMap[$file])) {
$uses[] = $isDebug ? $this->fileMap[$file][1] : $this->fileMap[$file][0];
} else {
$uses[] = $this->fileMap[$file];
}
} else {
$uses[] = $file;
}
}
$this->Javascript->link($uses, false);
}
$this->Javascript->cacheEvents($this->cacheToFile, true);
$this->Javascript->writeEvents(false);
} else {
echo $this->Javascript->writeEvents();
}
if (!empty($this->_scripts)) {
$scripts = "\$(function(){\n\t";
$scripts .= join(ife($isDebug, "\n\t", ' '), $this->_scripts);
$scripts .= "\n});";
$View = ClassRegistry::getObject('view');
$View->set('bottom_for_layout', $this->Javascript->codeBlock($scripts));
}
}
示例4: afterRender
/**
* After Render
*
* @param string $viewFile
*/
public function afterRender($viewFile)
{
parent::afterRender($viewFile);
if (BcUtil::isAdminSystem()) {
return;
}
if (empty($this->request->params['Site'])) {
return;
}
if (isset($this->request->params['Site']['name']) && is_null($this->request->params['Site']['name'])) {
return;
}
if (isset($this->request->params['Site']['device']) && $this->request->params['Site']['device'] != '') {
return;
}
// 別URLの場合、alternateを出力(スマートフォンのみ対応)
$pureUrl = $this->BcContents->getPureUrl($this->request->url, $this->request->params['Site']['id']);
$agent = BcAgent::find('smartphone');
$subSite = BcSite::findCurrentSub(false, $agent);
if (!$subSite) {
return;
}
$url = $subSite->makeUrl(new CakeRequest($pureUrl));
$this->_View->set('meta', $this->BcHtml->meta('canonical', $this->BcHtml->url($url, true), ['rel' => 'canonical', 'media' => 'only screen and (max-width: 640px)', 'type' => null, 'title' => null, 'inline' => false]));
}