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; ?>

网友评论(11)
1 Autoit 在 2006-06-18 23:40:22 发表
我发现有人在我站点提交了你的这个文章,里面有提到转载,不知道能不能发布,谢谢. 
 
[Ps:我的聚合一直没弄明白是哪里问题,后来也懒的在看了.所以就没在用]
2 blank 在 2006-06-19 08:43:08 发表
没关系 
你发布吧 
注明一下出处
3 autoit 在 2006-06-19 09:44:04 发表
已发布.链接地址
4joomla1.010无法使用用了之后< Prev Next >就消失了 游客 在 2006-06-28 18:27:30 发表
使用了之后< Prev Next >就消失了! 
 
站长有没有办法?很喜欢你的这种方法,符合国人的习惯
5 blank 在 2006-06-29 09:24:37 发表
不会啊 
你看看我的网站,不是都 在吗?
6 xtjxj 在 2007-05-07 11:11:40 发表
感谢,已经成功。
7joomla 1.5里面怎么做啊? 求救 在 2008-05-27 17:47:19 发表
好象和你说的文件不同 
而且1.5里面怎么添加上一篇和下一篇的链接呢? 
忘赐教
8 calkqn 在 2008-07-17 02:26:38 发表
pay loan get a cash loan loans for a small business apple cash fast loan payday auto loan repayment calculator
9 pdnmwo 在 2008-07-17 02:28:23 发表
applyforaloan get loan online horses for loan connecticut mortgage loan calculator short term cash loans
10 cptbwz 在 2008-07-17 02:35:14 发表
student loans interest only loans calculator cheapest loan auto calculator student loan consolidators
11 fzgrim 在 2008-07-17 02:43:44 发表
cash fast get loan federal stafford loan lender manufactured home loans www payday loan yes com cash loan bank



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