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


PHP SmartyPaginate::getLastText方法代码示例

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


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

示例1: smarty_function_paginate_last

/**
 * Project:     SmartyPaginate: Pagination for the Smarty Template Engine
 * File:        function.paginate_last.php
 * Author:      Monte Ohrt <monte at newdigitalgroup dot com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * @link http://www.phpinsider.com/php/code/SmartyPaginate/
 * @copyright 2001-2005 New Digital Group, Inc.
 * @author Monte Ohrt <monte at newdigitalgroup dot com>
 * @package SmartyPaginate
 * @version 1.6-dev
 */
function smarty_function_paginate_last($params, &$smarty)
{
    $_id = 'default';
    $_attrs = array();
    if (!class_exists('SmartyPaginate')) {
        $smarty->trigger_error("paginate_last: missing SmartyPaginate class");
        return;
    }
    if (!isset($_SESSION['SmartyPaginate'])) {
        $smarty->trigger_error("paginate_last: SmartyPaginate is not initialized, use connect() first");
        return;
    }
    foreach ($params as $_key => $_val) {
        switch ($_key) {
            case 'id':
                if (!SmartyPaginate::isConnected($_val)) {
                    $smarty->trigger_error("paginate_last: unknown id '{$_val}'");
                    return;
                }
                $_id = $_val;
                break;
            default:
                $_attrs[] = $_key . '="' . $_val . '"';
                break;
        }
    }
    if (SmartyPaginate::getTotal($_id) === false) {
        $smarty->trigger_error("paginate_last: total was not set");
        return;
    }
    $_url = SmartyPaginate::getURL($_id);
    //$_url = full_url();
    $_total = SmartyPaginate::getTotal($_id);
    $_limit = SmartyPaginate::getLimit($_id);
    $_attrs = !empty($_attrs) ? ' ' . implode(' ', $_attrs) : '';
    $_text = isset($params['text']) ? $params['text'] : SmartyPaginate::getLastText($_id);
    $_url .= strpos($_url, '?') === false ? '?' : '&';
    $_url .= SmartyPaginate::getUrlVar($_id) . '=';
    $_url .= $_total % $_limit > 0 ? $_total - $_total % $_limit + 1 : $_total - $_limit + 1;
    return '<a href="' . str_replace('&', '&amp;', $_url) . '"' . $_attrs . '>' . $_text . '</a>';
}
开发者ID:veganaize,项目名称:Collabtive,代码行数:66,代码来源:function.paginate_last.php

示例2: smarty_function_paginate_last

/**
 * Project:     SmartyPaginate: Pagination for the Smarty Template Engine
 * File:        function.paginate_last.php
 * Author:      Monte Ohrt <monte at newdigitalgroup dot com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * @link http://www.phpinsider.com/php/code/SmartyPaginate/
 * @copyright 2001-2005 New Digital Group, Inc.
 * @author Monte Ohrt <monte at newdigitalgroup dot com>
 * @package SmartyPaginate
 * @version 1.6-dev
 */

function smarty_function_paginate_last($params, &$smarty) {

    $_id = 'default';
    $_attrs = array();

    if (!class_exists('SmartyPaginate')) {
        $smarty->trigger_error("paginate_last: missing SmartyPaginate class");
        return;
    }
    if (!isset($_SESSION['SmartyPaginate'])) {
        $smarty->trigger_error("paginate_last: SmartyPaginate is not initialized, use connect() first");
        return;
    }

    foreach($params as $_key => $_val) {
        switch($_key) {
            case 'id':
                if (!SmartyPaginate::isConnected($_val)) {
                    $smarty->trigger_error("paginate_last: unknown id '$_val'");
                    return;
                }
                $_id = $_val;
                break;
            default:
                $_attrs[] = $_key . '="' . $_val . '"';
                break;
        }
    }

    if (SmartyPaginate::getTotal($_id) === false) {
        $smarty->trigger_error("paginate_last: total was not set");
        return;
    }

    $_url = $_SERVER['REQUEST_URI'];
    $url = explode("?", $_url);
    $aurl = $url[0];
    $url = $url[1];
    $url = explode("&", $url);
    $_url = "";
    $i = 0;
    foreach($url as $uri)
    {
        if (!strstr($uri, "next"))
        {
            if ($i > 0)
            {
                $_url .= "&" . $uri;
            }
            else
            {
                $_url .= $uri;
            }
        }
        $i = $i + 1;
    }
    $_url = $aurl . "?" . $_url;

    $_total = SmartyPaginate::getTotal($_id);
    $_limit = SmartyPaginate::getLimit($_id);

    $_attrs = !empty($_attrs) ? ' ' . implode(' ', $_attrs) : '';

    $_text = isset($params['text']) ? $params['text'] : SmartyPaginate::getLastText($_id);
    $_url .= (strpos($_url, '?') === false) ? '?' : '&';
    $_url .= SmartyPaginate::getUrlVar($_id) . '=';
    $_url .= ($_total % $_limit > 0) ? $_total - ( $_total % $_limit ) + 1 : $_total - $_limit + 1;

   // return '<a class = "next" href="' . str_replace('&','&amp;', $_url) . '"' . $_attrs . '>' . $_text . '</a>';
  return '<a  href="' . str_replace('&','&amp;', $_url) . '"' . $_attrs . '><img src = "templates/' . $smarty->tname . '/images/paging_next.png" alt = ""  /></a>';
}
开发者ID:janvalentik,项目名称:Collabtive,代码行数:97,代码来源:function.paginate_last.php

示例3: smarty_function_paginate_last

/**
 * Project:     SmartyPaginate: Pagination for the Smarty Template Engine
 * File:        function.paginate_last.php
 * Author:      Monte Ohrt <monte at newdigitalgroup dot com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * @link http://www.phpinsider.com/php/code/SmartyPaginate/
 * @copyright 2001-2005 New Digital Group, Inc.
 * @author Monte Ohrt <monte at newdigitalgroup dot com>
 * @package SmartyPaginate
 * @version 1.6-dev
 */
function smarty_function_paginate_last($params, &$smarty)
{
    global $startUp, $conf, $cat_id;
    $_id = 'default';
    $_attrs = array();
    if (!class_exists('SmartyPaginate')) {
        $smarty->trigger_error("paginate_last: missing SmartyPaginate class");
        return;
    }
    if (!isset($_SESSION['SmartyPaginate'])) {
        $smarty->trigger_error("paginate_last: SmartyPaginate is not initialized, use connect() first");
        return;
    }
    foreach ($params as $_key => $_val) {
        switch ($_key) {
            case 'id':
                if (!SmartyPaginate::isConnected($_val)) {
                    $smarty->trigger_error("paginate_last: unknown id '{$_val}'");
                    return;
                }
                $_id = $_val;
                break;
            default:
                $_attrs[] = $_key . '="' . $_val . '"';
                break;
        }
    }
    if (SmartyPaginate::getTotal($_id) === false) {
        $smarty->trigger_error("paginate_last: total was not set");
        return;
    }
    $_url = SmartyPaginate::getURL($_id);
    $_total = SmartyPaginate::getTotal($_id);
    $_limit = SmartyPaginate::getLimit($_id);
    $_attrs = !empty($_attrs) ? ' ' . implode(' ', $_attrs) : '';
    $_text = isset($params['text']) ? $params['text'] : SmartyPaginate::getLastText($_id);
    $_url .= strpos($_url, '?') === false ? '?' : '&';
    $_url .= SmartyPaginate::getUrlVar($_id) . '=';
    $_url .= $_total % $_limit > 0 ? $_total - $_total % $_limit + 1 : $_total - $_limit + 1;
    $lastId = $_total % $_limit > 0 ? $_total - $_total % $_limit + 1 : $_total - $_limit + 1;
    if ($cat_id != 'NULL') {
        if (!empty($_GET["sortedBy"]) || !empty($_GET["axis"])) {
            $final_url = $startUp->makeUrl(array('page' => $startUp->paginatePage, 'gost' => 'cat', 'catid' => $cat_id, 'next' => $lastId, 'sortedBy' => $_GET["sortedBy"], 'axis' => $_GET["axis"]));
        } else {
            $final_url = $startUp->makeUrl(array('page' => $startUp->paginatePage, 'gost' => 'cat', 'catid' => $cat_id, 'next' => $lastId));
        }
    } elseif ($_GET['page'] === "admincp") {
        $final_url = $startUp->makeUrl(array('page' => $startUp->paginatePage, 'next' => $lastId)) . '?tokenAdmin=' . $_COOKIE['tokenAdmin'];
    } else {
        if (!empty($_GET["sortedBy"]) || !empty($_GET["axis"])) {
            $final_url = $startUp->makeUrl(array('page' => $startUp->paginatePage, 'next' => $lastId, 'sortedBy' => $_GET["sortedBy"], 'axis' => $_GET["axis"]));
        } else {
            $final_url = $startUp->makeUrl(array('page' => $startUp->paginatePage, 'next' => $lastId));
        }
    }
    /* if ($cat_id!='NULL') 
    $final_url = $startUp->makeUrl(array('page'=>$startUp->paginatePage,'catid'=>$cat_id,'next'=>$lastId)); 
    else
    $final_url = $startUp->makeUrl(array('page'=>$startUp->paginatePage,'next'=>$lastId)); */
    return '<a href="' . $conf['baseurl'] . '/' . $final_url . '"' . $_attrs . '>' . $_text . '</a>';
    // return '<a href="' . str_replace('&','&amp;', $_url) . '"' . $_attrs . '>' . $_text . '</a>';
}
开发者ID:doio,项目名称:Bittytorrent,代码行数:87,代码来源:function.paginate_last.php


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