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


PHP uri::instance方法代码示例

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


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

示例1: render_summary

 /**
  * Returns the formatted html
  *
  * html example
  * e.g <h1>{TITLE}</h1><h2>{DATE}</h2><h3>by {AUTHOR}</h3>{IMAGE}{TEXT}<div class="spacer">&nbsp;</div>
  *
  * @param   array	$options	Options for the rendering array('count', 'date_format','image' = array($width,$height), 'word_count', 'html')
  * @return	string	$html		Formatted HTML
  */
 public function render_summary($options = null, $feedpost_options = null)
 {
     $array = array('per_page' => 5, 'pagination' => 'classic', 'template' => 'feed', 'html' => '{FEEDPOSTS}{PAGINATION}');
     if (!$options) {
         $config = Kohana::config_load('zest');
         $options = $config['feed.summary'];
     }
     $array = arr::overwrite($array, $options);
     $uri = uri::instance();
     $page = $uri->segment('page', 1);
     $feedposts = "";
     $posts = $this->get_posts($array['per_page'], ($page - 1) * $array['per_page']);
     foreach ($posts as $post) {
         $feedposts .= $post->render_summary($feedpost_options);
     }
     $pagination = new Pagination(array('uri_segment' => 'page', 'total_items' => count($this->get_posts()), 'items_per_page' => $array['per_page'], 'style' => $array['pagination']));
     if ($array['template'] != '') {
         $html = zest::template_to_html('snippets/' . $array['template']);
     } else {
         $html = $array['html'];
     }
     $html = str_replace("{RSS_LINK}", $this->get_rss(), $html);
     $html = str_replace("{FEEDPOSTS}", $feedposts, $html);
     $html = str_replace("{PAGINATION}", $pagination, $html);
     $html = str_replace("{FEED_LINK}", $this->get_url(), $html);
     return $html;
 }
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:36,代码来源:feed.php

示例2: get_by_url

 public static function get_by_url()
 {
     static $instance;
     if (empty($instance)) {
         $uri = uri::instance();
         $page = $uri->segment(1);
         $page = ORM::factory('page')->where(array('seoURL' => $page, 'status_id' => 2))->find();
         if ($page->id > 0) {
             $instance = $page;
         } else {
             $instance = null;
         }
     }
     return $instance;
 }
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:15,代码来源:zest_page.php

示例3: get_by_url

 /**
  * Returns a feedpost from the current url
  *
  * $param	bool	$unpublished	Return unpublished posts too?
  * @return	object|bool	$post		The feedpost generated by the url, or null if no feedpost found
  */
 public static function get_by_url($unpublished = false)
 {
     $uri = uri::instance();
     $feed = Feed_Model::get_by_url();
     if ($feed && $feed->id > 0) {
         $post_id = $uri->segment(2);
         $post = ORM::factory('feedpost', $post_id);
         if (!$unpublished) {
             if ($post->status_id == 2) {
                 return $post;
             }
         } else {
             return $post;
         }
     }
     return null;
 }
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:23,代码来源:zest_feedpost.php


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