/** * Get the URL of assets. * The base URL that contains all published asset files of yii-debug-toolbar. * @return string */ public function getAssetsUrl() { if (null === $this->_assetsUrl && 'cli' !== php_sapi_name()) { $this->_assetsUrl = GxcHelpers::publishAsset(dirname(__FILE__) . '/assets'); } return $this->_assetsUrl; }
public function renderPageSlug($slug) { $connection = Yii::app()->db; $command = $connection->createCommand('SELECT * FROM {{page}} WHERE slug=:slug limit 1'); $command->bindValue(':slug', $slug, PDO::PARAM_STR); $page = $command->queryRow(); if ($page) { //We first need to check if having Ajax Request if (isset($_REQUEST['ajax']) && strpos($_REQUEST['ajax'], ConstantDefine::AJAX_BLOCK_SEPERATOR) !== false) { $ajax = explode(ConstantDefine::AJAX_BLOCK_SEPERATOR, plaintext($_REQUEST['ajax'])); $block_id = $ajax[1]; $id = $ajax[0]; $block_ini = parse_ini_file(Yii::getPathOfAlias('common.blocks.' . $id) . DIRECTORY_SEPARATOR . 'info.ini'); //Include the class Yii::import('common.blocks.' . $id . '.' . $block_ini['class']); $layout_asset = GxcHelpers::publishAsset(Yii::getPathOfAlias('common.layouts.' . $page['layout'] . '.assets')); //Get the Block $command = $connection->createCommand('SELECT b.block_id,b.name,b.type,b.params FROM {{block}} b WHERE b.block_id=:bid Limit 1'); $command->bindValue(':bid', $block_id, PDO::PARAM_INT); $block = $command->queryRow(); if ($block !== false) { $this->widget('common.blocks.' . $id . '.' . $block_ini['class'], array('block' => $block, 'page' => $page, 'layout_asset' => $layout_asset)); } else { echo ''; } Yii::app()->end(); } else { $this->layout = 'main'; $this->pageTitle = $page['title']; $this->description = $page['description']; $this->keywords = $page['keywords']; //depend on the layout of the page, use the corresponding file to render $this->renderPage('common.layouts.' . $page['layout'] . '.' . $page['display_type'], array('page' => $page)); } } else { throw new CHttpException('404', t('cms', 'Oops! Page not found!')); } }
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <?php $assetsUrl = GxcHelpers::publishAsset(Yii::getPathOfAlias('cms.modules.install.assets'), false, -1, YII_DEBUG); ?> <link rel="stylesheet" type="text/css" media="all" href="<?php echo $assetsUrl; ?> /style.css" /> <link rel="stylesheet" type="text/css" media="all" href="<?php echo $assetsUrl; ?> /form.css" /> <title><?php echo t('cms', 'CMS Installer'); ?> </title> </head> <body> <div id="content" style="width:650px;margin:10px auto;padding:10px 0;"> <?php echo $content; ?> </div> </body>
<?php $layout_asset = GxcHelpers::publishAsset(Yii::getPathOfAlias('common.layouts.default.assets')); $this->renderPartial('common.layouts.default.header', array('page' => $page, 'layout_asset' => $layout_asset)); ?> <body> <div id="page"> <div id="header"> <div class="container"> <h1 class="logo-info"><?php echo settings()->get('general', 'site_name'); ?> </h1> </div> <?php //Render Widget for Header Region $this->widget('BlockRenderWidget', array('page' => $page, 'region' => '0', 'layout_asset' => $layout_asset)); ?> </div><!-- header --> <div class="container"> <div id="content"> <?php //Render Widget for Content Region $this->widget('BlockRenderWidget', array('page' => $page, 'region' => '1', 'layout_asset' => $layout_asset)); ?> </div> <div id="sidebar"> <?php