joomla 1.7:覆盖 pagination.php 不起作用

发布于 2024-12-23 16:20:41 字数 427 浏览 1 评论 0原文

我安装了joomla 1.7(window/xampp/php 5.3),我当前的模板是beez_20。我必须覆盖 pagination.php,为此我将 pagination.php 复制到

\libraries\joomla\html

\templates\beez_20\html。当我重新加载主页时,我收到一个损坏的模板,如下图所示。

在此处输入图像描述

当我从 html 文件夹中删除 pagination.php 时,我得到了正常的页面。我相信这是覆盖 pagination.php

缺少什么的正确方法?需要更改任何配置吗?请发表您的评论

提前致谢

I installed joomla 1.7(window/xampp/php 5.3) and my current template is beez_20. I have to override the pagination.php and to do so I copied the pagination.php from

\libraries\joomla\html

to

\templates\beez_20\html. When I reload the home page, I am getting a broken template as in the following picture.

enter image description here

I get the normal page when I remove the pagination.php from the html folder. I believe this is the correct method to override the pagination.php

what is missing ? need to change any configuration ? please post your comments

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

这个俗人 2024-12-30 16:20:41

我确实相信这是正确的方法...

这是一个 pagnation.php 供您尝试(对我有用):

<?php
// no direct access
defined('_JEXEC') or die('Restricted access');

/**
 * This is a file to add template specific chrome to pagination rendering.
 *
 * pagination_list_footer
 *   Input variable $list is an array with offsets:
 *       $list[limit]       : int
 *       $list[limitstart]  : int
 *       $list[total]       : int
 *       $list[limitfield]  : string
 *       $list[pagescounter]    : string
 *       $list[pageslinks]  : string
 *
 * pagination_list_render
 *   Input variable $list is an array with offsets:
 *       $list[all]
 *           [data]     : string
 *           [active]   : boolean
 *       $list[start]
 *           [data]     : string
 *           [active]   : boolean
 *       $list[previous]
 *           [data]     : string
 *           [active]   : boolean
 *       $list[next]
 *           [data]     : string
 *           [active]   : boolean
 *       $list[end]
 *           [data]     : string
 *           [active]   : boolean
 *       $list[pages]
 *           [{PAGE}][data]     : string
 *           [{PAGE}][active]   : boolean
 *
 * pagination_item_active
 *   Input variable $item is an object with fields:
 *       $item->base    : integer
 *       $item->link    : string
 *       $item->text    : string
 *
 * pagination_item_inactive
 *   Input variable $item is an object with fields:
 *       $item->base    : integer
 *       $item->link    : string
 *       $item->text    : string
 *
 * This gives template designers ultimate control over how pagination is rendered.
 *
 * NOTE: If you override pagination_item_active OR pagination_item_inactive you MUST             override them both
 */

function pagination_list_footer($list)
{
// Initialize variables
$lang =& JFactory::getLanguage();
$html = "<div class=\"list-footer\">\n";

if ($lang->isRTL())
{
    $html .= "\n<div class=\"counter\">".$list['pagescounter']."</div>";
    $html .= $list['pageslinks'];
    $html .= "\n<div class=\"limit\">".JText::_('Display     Num').$list['limitfield']."</div>";
}
else
{
    $html .= "\n<div class=\"limit\">".JText::_('Display     Num').$list['limitfield']."</div>";
    $html .= $list['pageslinks'];
    $html .= "\n<div class=\"counter\">".$list['pagescounter']."</div>";
}

$html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"".$list['limitstart']."\" />";
$html .= "\n</div>";

return $html;
}

function pagination_list_render($list)
{
// Initialize variables
$lang =& JFactory::getLanguage();
$html = "<div class=\"pagination\"><ul>";
// Reverse output rendering for right-to-left display
if($lang->isRTL())
{
    $html .= "<li class=\"pagination-start\">".$list['start']['data']."</li>";
    $html .= "<li class=\"pagination-prev\">".$list['previous']['data']."</li>";

    $list['pages'] = array_reverse( $list['pages'] );

    foreach( $list['pages'] as $page ) {
        if($page['data']['active']) {
            //  $html .= '<strong>';
        }

        $html .= "<li>".$page['data']."</li>";

        if($page['data']['active']) {
            // $html .= '</strong>';
        }
    }

    $html .= "<li class=\"pagination-next\">".$list['next']['data']."</li>";
    $html .= "<li class=\"pagination-end\">".$list['end']['data']."</li>";
    // $html .= '«';
}
else
{

    foreach( $list['pages'] as $page )
    {
        if($page['data']['active']) {
            // $html .= '<strong>';
        }

        $html .= "<li>".$page['data']."</li>";

        if($page['data']['active']) {
            //  $html .= '</strong>';
        }
    }


}
$html .= "</ul></div>";
return $html;
}
?>

I do belive this is the correct way to do it...

Here is a pagnation.php for you to try with (works for me):

<?php
// no direct access
defined('_JEXEC') or die('Restricted access');

/**
 * This is a file to add template specific chrome to pagination rendering.
 *
 * pagination_list_footer
 *   Input variable $list is an array with offsets:
 *       $list[limit]       : int
 *       $list[limitstart]  : int
 *       $list[total]       : int
 *       $list[limitfield]  : string
 *       $list[pagescounter]    : string
 *       $list[pageslinks]  : string
 *
 * pagination_list_render
 *   Input variable $list is an array with offsets:
 *       $list[all]
 *           [data]     : string
 *           [active]   : boolean
 *       $list[start]
 *           [data]     : string
 *           [active]   : boolean
 *       $list[previous]
 *           [data]     : string
 *           [active]   : boolean
 *       $list[next]
 *           [data]     : string
 *           [active]   : boolean
 *       $list[end]
 *           [data]     : string
 *           [active]   : boolean
 *       $list[pages]
 *           [{PAGE}][data]     : string
 *           [{PAGE}][active]   : boolean
 *
 * pagination_item_active
 *   Input variable $item is an object with fields:
 *       $item->base    : integer
 *       $item->link    : string
 *       $item->text    : string
 *
 * pagination_item_inactive
 *   Input variable $item is an object with fields:
 *       $item->base    : integer
 *       $item->link    : string
 *       $item->text    : string
 *
 * This gives template designers ultimate control over how pagination is rendered.
 *
 * NOTE: If you override pagination_item_active OR pagination_item_inactive you MUST             override them both
 */

function pagination_list_footer($list)
{
// Initialize variables
$lang =& JFactory::getLanguage();
$html = "<div class=\"list-footer\">\n";

if ($lang->isRTL())
{
    $html .= "\n<div class=\"counter\">".$list['pagescounter']."</div>";
    $html .= $list['pageslinks'];
    $html .= "\n<div class=\"limit\">".JText::_('Display     Num').$list['limitfield']."</div>";
}
else
{
    $html .= "\n<div class=\"limit\">".JText::_('Display     Num').$list['limitfield']."</div>";
    $html .= $list['pageslinks'];
    $html .= "\n<div class=\"counter\">".$list['pagescounter']."</div>";
}

$html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"".$list['limitstart']."\" />";
$html .= "\n</div>";

return $html;
}

function pagination_list_render($list)
{
// Initialize variables
$lang =& JFactory::getLanguage();
$html = "<div class=\"pagination\"><ul>";
// Reverse output rendering for right-to-left display
if($lang->isRTL())
{
    $html .= "<li class=\"pagination-start\">".$list['start']['data']."</li>";
    $html .= "<li class=\"pagination-prev\">".$list['previous']['data']."</li>";

    $list['pages'] = array_reverse( $list['pages'] );

    foreach( $list['pages'] as $page ) {
        if($page['data']['active']) {
            //  $html .= '<strong>';
        }

        $html .= "<li>".$page['data']."</li>";

        if($page['data']['active']) {
            // $html .= '</strong>';
        }
    }

    $html .= "<li class=\"pagination-next\">".$list['next']['data']."</li>";
    $html .= "<li class=\"pagination-end\">".$list['end']['data']."</li>";
    // $html .= '«';
}
else
{

    foreach( $list['pages'] as $page )
    {
        if($page['data']['active']) {
            // $html .= '<strong>';
        }

        $html .= "<li>".$page['data']."</li>";

        if($page['data']['active']) {
            //  $html .= '</strong>';
        }
    }


}
$html .= "</ul></div>";
return $html;
}
?>
过气美图社 2024-12-30 16:20:41

您不应该以您尝试的方式覆盖整个pagination.php。您只能覆盖某些功能。您看到此页面的原因是,如果您复制了整个 pagination.php 文件而不进行任何更改,那么您将重新声明 JPagination 类,而您无法这样做。

当您尝试更改 pagination.php 时,您应该只重写您想要覆盖的函数,而不是复制整个文件。

请查看这篇文章,它有点过时,但该信息即使在 J 中仍然适用! 2.5
http://docs.joomla.org/Understand_Output_Overrides

You should not override the entire pagination.php in the manner you tried. You can only override certain functions. The reason you are seeing this page is because if you copied the entire pagination.php file with out changing anything, so you are re-declaring the JPagination class and you can't do that.

When you are try to make changes to the pagination.php you should only re-write the functions you wish to override not copy the entire file.

Please check out this article it's a little dated but the information still applies even in J! 2.5
http://docs.joomla.org/Understanding_Output_Overrides

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文