当前位置: 首页>>代码示例>>PHP>>正文


PHP CController::afterRender方法代码示例

本文整理汇总了PHP中CController::afterRender方法的典型用法代码示例。如果您正苦于以下问题:PHP CController::afterRender方法的具体用法?PHP CController::afterRender怎么用?PHP CController::afterRender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CController的用法示例。


在下文中一共展示了CController::afterRender方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: afterRender

 protected function afterRender($view, &$output)
 {
     $this->onAfterRender(new CEvent($this));
     parent::afterRender($view, $output);
     if (Yii::app()->facebook->jsSdk) {
         // if we have disabled this (like on the Facebook Page view), do none of it
         Yii::app()->facebook->ogTags['site_name'] = CHtml::encode(Yii::app()->name);
         if ($this->ogImage) {
             Yii::app()->facebook->ogTags['image'] = $this->ogImage;
         } else {
             Yii::app()->facebook->ogTags['image'] = Yii::app()->params->siteUrl . 'img/logo-dark.jpg';
         }
         if ($this->pageTitle) {
             Yii::app()->facebook->ogTags['title'] = $this->pageTitle;
         }
         if ($this->metaDesc) {
             Yii::app()->facebook->ogTags['description'] = $this->metaDesc;
         } else {
             Yii::app()->facebook->ogTags['description'] = "Small Potatoes is an online garden surplus for the neighborhood. Anyone who loves locally grown produce can connect with their neighborhood gardeners, purchase their excess harvest, and support their hyper-local food community.";
         }
         Yii::app()->facebook->renderOGMetaTags();
         $js = "\n        \$('#fb-login-button').on('click',function(){\n          FB.login(function(response) {\n            if (response.authResponse) {\n              window.location = '" . $this->createUrl('user/register') . "';\n            }\n          }, {scope: 'email,user_location'});\n          return false;\n        });\n\n      ";
         if (Yii::app()->facebook->getUser()) {
             $js .= "\n        FB.getLoginStatus(function(response) {\n          if (response.status == 'connected') { // only bind this to the logout button if the user is logged in to FB\n            \$('#logout').click(function (e) {\n              FB.getLoginStatus(function(response) { // only do this if the user is logged in with Facebook\n                if (response.authResponse) {\n                  if(!e) var e = window.event;\n                  FB.logout(function(response) { // when logout is complete, redirect to logout from SplashLab as well\n                    window.location = '" . $this->createUrl('site/logout') . "';\n                  });\n                }\n              });\n              return false;\n            });\n          }\n        });\n        ";
         }
         Yii::app()->facebook->addJsCallback($js);
         Yii::app()->facebook->initJs($output);
         // this initializes the JS
         Yii::app()->clientScript->registerScript("ga", "var _gaq = _gaq || [];\n      _gaq.push(['_setAccount', 'UA-34947582-1']);\n      _gaq.push(['_trackPageview']);\n\n      (function() {\n        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n      })();", CClientScript::POS_END);
     }
     return true;
 }
开发者ID:narwold,项目名称:Small-Potatoes,代码行数:32,代码来源:Controller.php

示例2: afterRender

 protected function afterRender($view, &$output)
 {
     parent::afterRender($view, $output);
     //Yii::app()->facebook->addJsCallback($js); // use this if you are registering any $js code you want to run asyc
     //***************before using FB own sdk************
     //   Yii::app()->facebook->initJs($output); // this initializes the Facebook JS SDK on all pages
     //  Yii::app()->facebook->renderOGMetaTags(); // this renders the OG tags
     return true;
 }
开发者ID:redsn0w422,项目名称:DarshanVis,代码行数:9,代码来源:Controller.php

示例3: afterRender

 /**
  * @param string $view
  * @param string $output
  */
 protected function afterRender($view, &$output)
 {
     parent::afterRender($view, $output);
     if ($this->enableFacebook && \Yii::app()->hasComponent('facebook')) {
         // Activation des SDK pour l'extension yii-facebook-opengraph
         // @internal cf. composant 'facebook' dans la configuration
         \Yii::app()->facebook->initJs($output);
         // this initializes the Facebook JS SDK on all pages
         /** @noinspection PhpUndefinedFieldInspection */
         \Yii::app()->facebook->renderOGMetaTags();
         // this renders the OG tags
     }
 }
开发者ID:ChristopheBrun,项目名称:hLib,代码行数:17,代码来源:BaseController.php

示例4: afterRender

 protected function afterRender($view, &$output)
 {
     parent::afterRender($view, $output);
     //Yii::app()->facebook->addJsCallback($js); // use this if you are registering any $js code you want to run asyc
     if (_xls_facebook_login()) {
         Yii::app()->facebook->initJs($output);
         // this initializes the Facebook JS SDK on all pages
     }
     return true;
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:10,代码来源:Controller.php

示例5: afterRender

 /**
  * This method is invoked after the specified is rendered by calling {@link CController::render()}.
  * Note that this method is invoked BEFORE {@link CController::processOutput()}.
  * You may override this method to do some postprocessing for the view rendering.
  * @param string $view the view that has been rendered
  * @param string $output the rendering result of the view. Note that this parameter is passed
  * as a reference. That means you can modify it within this method.
  */
 protected function afterRender($view, &$output)
 {
     SourceBans::app()->trigger('app.afterRender', new CEvent($this, array('view' => $view, 'output' => &$output)));
     parent::afterRender($view, $output);
 }
开发者ID:Saltly,项目名称:SourceBans,代码行数:13,代码来源:Controller.php


注:本文中的CController::afterRender方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。