5月 17 2006
 
打印 E-mail
2006-05-17
::页面导航::
 
页面 2
本文介绍了通过修改joomla中的文件来实现加入上下篇标题的方法。适用于joomla1.07、1.08版本。 修改components\com_content\content.php文件 找到
 
$query = "SELECT a.id"
. "\n FROM #__content AS a"
. "\n WHERE a.catid = $row->catid"
. "\n AND a.state = $row->state"
. ($access->canEdit ? '' : "\n AND a.access <= $gid" )
. $xwhere
. "\n ORDER BY $orderby";
$database->setQuery( $query );
$list = $database->loadResultArray();
在后面加入语句,作用是加入标题
 
$query = "SELECT a.title"
. "\n FROM #__content AS a"
. "\n WHERE a.catid = $row->catid"
. "\n AND a.state = $row->state"
. ($access->canEdit ? '' : "\n AND a.access <= $gid" )
. $xwhere
. "\n ORDER BY $orderby";
$database->setQuery( $query );
$list1 = $database->loadResultArray();
找到
 
if ( $location - 1 >= 0 ) {
// the previous content item cannot be in the array position -1
$row->prev = $list[$location - 1]; 
}
if ( ( $location + 1 ) < count( $list ) ) {
// the next content item cannot be in an array position greater than the number of array postions
$row->next = $list[$location + 1];
}
加入两句就成这样
 
 if ( $location - 1 >= 0 ) {
// the previous content item cannot be in the array position -1
$row->prev = $list[$location - 1];
$row->prevtitle=$list1[$location - 1];//加入
 }
if ( ( $location + 1 ) < count( $list ) ) {
// the next content item cannot be in an array position greater than the number of array postions
$row->next = $list[$location + 1];
$row->nexttitle=$list1[$location + 1];//加入
}
到此这个文件修改完毕 再修改content.html.php文件 找到这两句
 
<?php echo _ITEM_PREVIOUS; ?>
.....
<?php echo _ITEM_NEXT; ?>
改成
 
<?php echo _ITEM_PREVIOUS.$row->prevtitle; ?>
.....
<?php echo _ITEM_NEXT.$row->nexttitle; ?>

姓名:
电子邮件
主页
标题:
BBCode:Web AddressEmail AddressBold TextItalic TextUnderlined TextQuoteCodeOpen ListList ItemClose List
评论:


验证码:* Code



 
上一篇:joomla模板的官方教程   下一篇:virtuemart(购物车)的flash教程