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


PHP Pages::get_home_page_url方法代码示例

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


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

示例1: get_categories

 /**
  * Returns the categories
  *
  * @param	FTL_Binding
  * @param	array/null
  *
  * @return	array
  *
  */
 public static function get_categories(FTL_Binding $tag)
 {
     // Categories model
     self::$ci->load->model('category_model');
     // Current page
     $page = $tag->get('page');
     // Local storage key
     $lsk = '__all__';
     // Get the local cache data
     $element_name = $tag->getParentName();
     $element = $tag->get($element_name);
     if (!is_null($element)) {
         $lsk = '__' . $element_name . '__' . $element['name'];
     }
     // Set the local cache data
     if (!isset(self::$categories[$lsk])) {
         // CSS class to use for the current category
         $active_class = $tag->getAttribute('active_class', 'active');
         // Asked category
         $asked_category_name = self::get_asked_category_uri();
         // Check if the element has one category array (eg. for Articles)
         if (isset($element['categories'])) {
             $categories = $element['categories'];
             // Fix the 'nb' key (nb_articles using this category)
             foreach ($categories as $key => $category) {
                 $categories[$key]['nb'] = '1';
             }
         } else {
             if ($element_name == 'page') {
                 $id_page = !is_null($page) ? $page['id_page'] : NULL;
             } else {
                 $id_page = NULL;
             }
             $categories = self::$ci->category_model->get_categories_list($id_page, Settings::get_lang());
         }
         $page_url = !is_null($page) ? trim($page['absolute_url'], '/') . '/' : Pages::get_home_page_url();
         $category_uri_segment = self::get_config_special_uri_segment('category');
         // Add the URL to the category to each category row
         // Also add the active class
         foreach ($categories as $key => $category) {
             $categories[$key]['url'] = $page_url . $category_uri_segment . '/' . $category['name'];
             $categories[$key]['lang_url'] = $page_url . $category_uri_segment . '/' . $category['name'];
             // Active category ?
             $categories[$key]['active_class'] = $category['name'] == $asked_category_name ? $active_class : '';
             $categories[$key]['is_active'] = !empty($categories[$key]['active_class']) ? TRUE : FALSE;
         }
         self::$categories[$lsk] = array_values($categories);
     }
     return self::$categories[$lsk];
 }
开发者ID:pompalini,项目名称:emngo,代码行数:59,代码来源:Category.php

示例2: get_archives

 public static function get_archives(FTL_Binding $tag)
 {
     // Categories model
     self::$ci->load->model('article_model');
     // Page
     $page = $tag->get('page');
     if (is_null($page)) {
         $page = self::registry('page');
     }
     // Period format. see : http://php.net/manual/fr/function.date.php
     $format = $tag->getAttribute('format', 'F');
     // Attribute : active class
     $active_class = $tag->getAttribute('active_class', 'active');
     // filter
     $filter = $tag->getAttribute('filter', FALSE);
     if ($filter != FALSE) {
         $filter = self::process_filter($filter);
     }
     // month
     $with_month = $tag->getAttribute('month');
     // order
     $order = $tag->getAttribute('order');
     $order = $order == 'ASC' ? 'period ASC' : 'period DESC';
     // Archive string : 'yyyy' or 'yyyy.mm'. Used for CSS active class
     $_archive_string = '';
     // Archive URI args
     $args = self::get_special_uri_array('archives');
     if (!empty($args)) {
         $_archive_string = isset($args[0]) ? $args[0] : '';
         $_archive_string .= isset($args[1]) ? '.' . $args[1] : '';
     }
     // Archives URI segment, as set in the config file
     $archives_uri_segment = self::get_config_special_uri_segment('archives');
     // Get the archives
     $archives = self::$ci->article_model->get_archives_list(array('id_page' => $page['id_page']), Settings::get_lang(), $filter, $with_month, $order);
     // Translated period array
     $month_formats = array('D', 'l', 'F', 'M');
     $page_url = !is_null($page) ? $page['absolute_url'] . '/' : Pages::get_home_page_url();
     foreach ($archives as &$row) {
         $year = substr($row['period'], 0, 4);
         $month = substr($row['period'], 4);
         if ($month != '') {
             $month = strlen($month) == 1 ? '0' . $month : $month;
             $timestamp = mktime(0, 0, 0, $month, 1, $year);
             // Get date in the wished format
             $period = (string) date($format, $timestamp);
             // Translate the period month
             if (in_array($format, $month_formats)) {
                 $period = lang(strtolower($period));
             }
             $row['period'] = $period . ' ' . $year;
             $row['url'] = $page_url . $archives_uri_segment . '/' . $year . '/' . $month;
             $row['active_class'] = $year . '.' . $month == $_archive_string ? $active_class : '';
         } else {
             $row['period'] = $year;
             $row['url'] = $page_url . $archives_uri_segment . '/' . $year;
             $row['active_class'] = $year == $_archive_string ? $active_class : '';
         }
         $row['is_active'] = !empty($row['active_class']) ? TRUE : FALSE;
     }
     return $archives;
 }
开发者ID:pompalini,项目名称:emngo,代码行数:62,代码来源:Archive.php


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