Solution to missing pathway on content pages

Moderator: mcsmom

Post Reply
User avatar
lashae
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Sun Aug 21, 2005 9:00 am
Location: ODTU
Contact:

Solution to missing pathway on content pages

Post by lashae » Fri Nov 03, 2006 10:24 pm

On content pages my system was not showing the pathway although Itemid's were set. I developed the following solution and it works; it has to work in deed ;D

First of all i made all content links in the menus to UNIQUE ITEMID

Then replaced the standard mospathway() statement in the template file with the following; which take cares of the generation of the pathway for content pages itself...

Code: Select all

<?php 
   
$opt   = trim(strip_tags(addslashes($_REQUEST['option'])));
$Itemid   = trim(strip_tags(addslashes($_REQUEST['Itemid'])));

if($opt == 'com_content' && isset($Itemid) )
{
   $parento = $Itemid;
   $mystack      = array();
      $mn = -1;
      while($parento!=0)
      {      
         $mn++;
         $sql      = "SELECT id, name, link, parent FROM portal_menu WHERE id=".$parento;
         $gelenp      = @mysql_query($sql);
         $pathD      = @mysql_fetch_array($gelenp);
         $parento   = $pathD['parent'];
         $mystack[$mn][0]= $pathD['name'];
         $mystack[$mn][1]= $pathD['link'].'&Itemid='.$pathD['id'];      
      }

   $yoncaPath = '<span class="pathway">';
   //Pathway Anasayfa ile baslar...
   $yoncaPath .= 'Anasayfa '; // Homepage link text
   $yoncaPath .= '<img src="images/M_images/arrow.png" alt="arrow"> ';

   for($j=$mn; $j>=0; $j--)
   {
      //Pathway Anasayfa ile baþlar...
      $yoncaPath .=   $mystack[$j][0].' ';
      if($mystack[($j-1)][0])
         $yoncaPath .=   '<img src="images/M_images/arrow.png" alt="arrow"> ';
   }
   $yoncaPath .= '</span>';
   echo $yoncaPath;   
}
else
{
   mosPathWay();
}
?>


Additionally:

I didn't want to make pathway clickable for content pages, however if you need to make all items in the pathway links; you can benefit from the following snippet:

Code: Select all

<?php 
   
$opt   = trim(strip_tags(addslashes($_REQUEST['option'])));
$Itemid   = trim(strip_tags(addslashes($_REQUEST['Itemid'])));

if($opt == 'com_content' && isset($Itemid) )
{
   $parento = $Itemid;
   $mystack      = array();
      $mn = -1;
      while($parento!=0)
      {      
         $mn++;
         $sql      = "SELECT id, name, link, parent FROM portal_menu WHERE id=".$parento;
         $gelenp      = @mysql_query($sql);
         $pathD      = @mysql_fetch_array($gelenp);
         $parento   = $pathD['parent'];
         $mystack[$mn][0]= $pathD['name'];
         $mystack[$mn][1]= $pathD['link'].'&Itemid='.$pathD['id'];      
      }

   $yoncaPath = '<span class="pathway">';
   //Pathway Anasayfa ile baslar...
   $yoncaPath .= 'Anasayfa '; // Homepage link text
   $yoncaPath .= '<img src="images/M_images/arrow.png" alt="arrow"> ';

   for($j=$mn; $j>=0; $j--)
   {
      //Pathway Anasayfa ile baþlar...
      $yoncaPath .=   '<a class="pathway" href="'.$mystack[$j][1].'">'.$mystack[$j][0].'</a> ';
      if($mystack[($j-1)][0])
         $yoncaPath .=   '<img src="images/M_images/arrow.png" alt="arrow"> ';
   }
   $yoncaPath .= '</span>';
   echo $yoncaPath;   
}
else
{
   mosPathWay();
}
?>
Last edited by lashae on Fri Nov 03, 2006 10:29 pm, edited 1 time in total.
Peace at
home, peace in the world.''
- Mustafa Kemal Atatürk

Post Reply