示例#1
0
 public function sidebar($sidebarId = null)
 {
     if (is_null($sidebarId) && !in_array($sidebarId, Configure::read('sidebars'))) {
         return false;
     }
     $sidebar_widgets = unserialize(Configure::read(Configure::read('template') . '.widgets'));
     $widgets = Configure::read('widgets');
     if (Configure::check(Configure::read('template') . '.widgets') && !is_null(Configure::read(Configure::read('template') . '.widgets'))) {
         $this->_View->start($sidebarId);
         foreach ($sidebar_widgets[$sidebarId] as $widget) {
             $sidebar = Configure::read('sidebars')[$sidebarId];
             echo sprintf($sidebar['before_widget'], $widget['unique-id'], $sidebar['class']);
             echo $sidebar['before_title'];
             echo isset($widget['title']) && !empty($widget['title']) ? $widget['title'] : $widgets[$widget['widget-id']]['title'];
             echo $sidebar['after_title'];
             echo $this->_View->element('Widgets/' . $widgets[$widget['widget-id']]['element'], array('data' => HuradWidget::getWidgetData($widget['unique-id'])));
             echo $sidebar['after_widget'];
         }
         $this->_View->end();
     }
     echo $this->_View->fetch($sidebarId);
 }
示例#2
0
 */
HuradWidget::registerWidget(['title' => __d('hurad', 'Authors'), 'element' => 'authors']);
/**
 * Categories widget
 */
HuradWidget::registerWidget(['title' => __d('hurad', 'Categories'), 'element' => 'categories']);
/**
 * Recent Posts widgets
 */
HuradWidget::registerWidget(['title' => __d('hurad', 'Recent Posts'), 'element' => 'recent-posts']);
/**
 * Recent Comments widgets
 */
HuradWidget::registerWidget(['title' => __d('hurad', 'Recent Comments'), 'element' => 'recent-comments']);
/**
 * Pages widget
 */
HuradWidget::registerWidget(['title' => __d('hurad', 'Pages'), 'element' => 'pages']);
/**
 * Text widget
 */
HuradWidget::registerWidget(['title' => __d('hurad', 'Text'), 'element' => 'text']);
/**
 * Links widget
 */
HuradWidget::registerWidget(['title' => __d('hurad', 'Links'), 'element' => 'links']);
/**
 * RSS widget
 */
HuradWidget::registerWidget(['title' => __d('hurad', 'RSS'), 'element' => 'rss']);
示例#3
0
文件: bootstrap.php 项目: hurad/hurad
<?php

HuradWidget::registerSidebar(array('name' => __('Right Sidebar'), 'id' => 'right-sidebar', 'before_widget' => '<div class="panel panel-default">', 'after_widget' => '</div></div>', 'before_title' => '<div class="panel-heading">', 'after_title' => '</div><div class="panel-body">'));