* который выполняется до загрузки HTML, вывод данных в этом блоке делать * не надо */ Block::run('PRE'); }); Observer::observe('frontpage_after_render', function () { /** * Запуск метода в виджетах текущей страницы * Model_Widget_Decorator::after_page_load */ Observer::notify('after_page_load'); /** * Блок служит для помещения в него виджета с произволным PHP кодом, * который выполняется после загрузки HTML */ Block::run('POST'); }); Observer::observe('view_page_edit_plugins', function ($page) { $blocks = Widget_Manager::get_blocks_by_layout($page->layout()); echo View::factory('widgets/page/edit', array('page' => $page, 'pages' => Model_Page_Sitemap::get(TRUE)->exclude(array($page->id))->flatten(), 'widgets' => Widget_Manager::get_widgets_by_page($page->id), 'blocks' => Arr::get($blocks, $page->layout()))); }); Observer::observe('page_add_after_save', function ($page) { $post_data = Request::current()->post('widgets'); if (!empty($post_data['from_page_id'])) { Widget_Manager::copy($post_data['from_page_id'], $page->id); } }); Observer::observe('page_edit_after_save', function ($page) { $post_data = Request::current()->post('widget'); if (!is_array($post_data)) { return;
/** * Adds a Block to the grid at the given position. * * @param Block $block Block object to be added at the grid * @param int $row Block row in the grid * @param int $column Block column in the grid * @param int $position Block position in the cell * * @return Grid grid object */ public function addBlock(Block $block, $row, $column, $position) { // Process the block and build the block HTML. $block->run($this->context->getRequest(), $this->context->getResponse()); // Set default row if not given. if (!$row) { $row = 1; } // Set default column it not given. if (!$column) { $column = 1; } // Set default position inside the cell if not given. if (!$position) { $position = 1; } // Set block name. $block_name = 'block_' . $row . '_' . $column . '_' . $position; $this->set($block_name, $block); $this->blocks[$row][$column][$position] = $block_name; return $this; }
</title> <link><?php echo BASE_URL; ?> </link> <atom:link href="<?php echo BASE_URL; ?> /rss.xml" rel="self" type="application/rss+xml" /> <language>en-us</language> <copyright>Copyright <?php echo date('Y'); ?> , kodicms.ru</copyright> <pubDate><?php echo date('r'); ?> </pubDate> <lastBuildDate><?php echo date('r'); ?> </lastBuildDate> <category>any</category> <generator>KodiCMS</generator> <description>The main news feed from KodiCMS.</description> <docs>http://www.rssboard.org/rss-specification</docs> <?php Block::run('body'); ?> </channel> </rss>
echo $page->title(); ?> </h1> </div> <?php Block::run('body'); ?> <?php Block::run('pagination'); ?> <?php Block::run('extended'); ?> </div> <div class="col-md-3"> <?php Block::run('sidebar'); ?> <?php Block::run('recent'); ?> </div> </div> <?php Block::run('footer'); ?> </div> <!-- end #page --> </body> </html>
protected function block($name) { Block::run($name); }