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


PHP SmartyPaginate::getLastItem方法代码示例

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


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

示例1: assign

 /**
  * assign $paginate var values
  *
  * @param obj &$smarty the smarty object reference
  * @param string $var the name of the assigned var
  * @param string $id the pagination id
  */
 public static function assign(&$smarty, $var = 'paginate', $id = 'default')
 {
     if (is_object($smarty) && (strtolower(get_class($smarty)) == 'smarty' || is_subclass_of($smarty, 'smarty'))) {
         $_paginate['total'] = SmartyPaginate::getTotal($id);
         $_paginate['first'] = SmartyPaginate::getCurrentItem($id);
         $_paginate['last'] = SmartyPaginate::getLastItem($id);
         $_paginate['page_current'] = ceil(SmartyPaginate::getLastItem($id) / SmartyPaginate::getLimit($id));
         $_paginate['page_total'] = ceil(SmartyPaginate::getTotal($id) / SmartyPaginate::getLimit($id));
         $_paginate['size'] = $_paginate['last'] - $_paginate['first'];
         $_paginate['url'] = SmartyPaginate::getUrl($id);
         $_paginate['urlvar'] = SmartyPaginate::getUrlVar($id);
         $_paginate['current_item'] = SmartyPaginate::getCurrentItem($id);
         $_paginate['prev_text'] = SmartyPaginate::getPrevText($id);
         $_paginate['next_text'] = SmartyPaginate::getNextText($id);
         $_paginate['limit'] = SmartyPaginate::getLimit($id);
         $_item = 1;
         $_page = 1;
         while ($_item <= $_paginate['total']) {
             $_paginate['page'][$_page]['number'] = $_page;
             $_paginate['page'][$_page]['item_start'] = $_item;
             $_paginate['page'][$_page]['item_end'] = $_item + $_paginate['limit'] - 1 <= $_paginate['total'] ? $_item + $_paginate['limit'] - 1 : $_paginate['total'];
             $_paginate['page'][$_page]['is_current'] = $_item == $_paginate['current_item'];
             $_item += $_paginate['limit'];
             $_page++;
         }
         $smarty->assign($var, $_paginate);
     } else {
         trigger_error("SmartyPaginate: [assign] I need a valid Smarty object.");
         return false;
     }
 }
开发者ID:doio,项目名称:Bittytorrent,代码行数:38,代码来源:SmartyPaginate.class.php


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