In joomla (version 1.0.x), whenever any Item displayed in details mode then the navigation of others item under same section/category shows in below format:
<< >>
If I would like to replace this simple navigation format with the title of others items under same section how it would be like?I think it would be more meaningful navigation.Any way, it’s turn to do the main things.
- Open the /component/com_content/content.html.php
- Find out the function named navigation() . line # 892
- Pest the following code inside the beginning of the function.
/*** Link list type navigaton
*@author : wasiur@gmail.com
*/
global $task, $mainframe, $database, $my;
/*Checking whether it is frontpage component or not and the task also
we don't want to it in frontapge*/
if(($_REQUEST["option"]!="com_frontpage") && ($_REQUEST["task"]=="view") ){
$opt=mosGetParam($_REQUEST,'option','');
if(eregi('content',$opt)){
$tsk=mosGetParam($_REQUEST,'task','');
$sid=mosGetParam($_REQUEST,'id','0');
if(eregi('category',$tsk)){
$row = new mosCategory( $database );
$row->load( $sid );
$sect=$row->section;
}elseif (eregi('view',$tsk)){
$row = new mosContent( $database );
$row->load( $sid );
$sect=$row->sectionid;
}else{
$sect=$sid; //$sect always contain the section id from url query string
}
}
$nullDate = $database->getNullDate(); //used for published check
$now = _CURRENT_SERVER_TIME; //ditto
//Select query checks whether item is published, is not checked out and whether user has permission to access item
$listque="SELECT id, title, created FROM #__content WHERE (sectionid IN (".$sect."))" //has specified id(s)
. " AND ( '$now' <= publish_down OR publish_down = '$nullDate' AND state = 1 )" //published
. " AND ( checked_out = 0 OR checked_out = $my->id )” //not checked out or checked out by me
. ” AND (access <= $my->gid)” //permission to access
. ” ORDER BY created desc”
. ” LIMIT 5″; //limit number of items to return
//query the DB
$database->setQuery( $listque );
$database->query();
//load items into object array
$content_list=$database->loadObjectList();
$total=count($content_list);
for ($i=0;$i<$total; $i++){ //showing with making link for each item $link="index.php?option=com_content&task=view&id=".$content_list[$i]->id.”&Itemid=”.$mainframe->getItemid($content_list[$i]->id); echo “
“;
}
}
- save the file and Show the list navigation
Sample output :

Thanks
Tags: PHP, Tips & Tricks, joomla // Add Comment »