Joomla tags

a real free joomla tag system

  • Increase font size
  • Default font size
  • Decrease font size
 Joomla Tags Support Forum :: Feature Request
Welcome Guest   
 Subject :Itemid on tags links to allow module placement on com_tag views.. 2009-09-10 19:02:53 
thbnelson
Apprentice
Joined: 2009-08-24 22:14:26
Posts: 2
Location
<p>I would like to be able to assign modules to the various tag views.<br /><br />To do this the tags that are linked need to include an Itemid so joomla can select the appropriate modules for that Menu Item..<br /><br />I have created an update to version 1.2.8 that will force the item id of the first "alltags" menu item item finds onto all tags links.<br /><br />This will give me at least one Menu Item that I can assign modules to for use by all the various tag component views.<br /><br />The approach I took was to add the following function to components/com_tag/helper/<strong>helper.php</strong><br /><br /> function getItemidLink(){<br />  $itemid = null;<br />  $component =& JComponentHelper::getComponent('com_tag');<br />  $menus  = &JApplication::getMenu('site', array());<br />  $activeMenu = $menus->getActive();<br />  if ($activeMenu->componentid == $component->id) {<br />   $itemid = $activeMenu->id;<br />  } else {<br />   $items  = $menus->getItems('componentid', $component->id);<br />   foreach ($items as &$menu) {<br />    if (@$menu->query == 'alltags') {
     $itemid = $menu->id;
     break;
    }
   }
   if (!isset($itemid) && count($items)) {
    $itemid = $items[0]->id;<br />   }<br />  }<br />  return($itemid ? '&Itemid='.$itemid : '');<br /> }<br /><br />And then call that function at every occurance where a link is rendered, for example, in plg_tags_content <br /><br />... near all the other initialization for onPrepareContent so it is only done once ...<br /><br />  $itemidLink = JoomlaTagsHelper::getItemidLink();<br /><br />... then in the foreach $terms loop ...<br /><br />    $link='index.php?option=com_tag&task=tag&tag='.urlencode($term->name)<strong>.$itemidLink</strong>;<br /><br />...<br /><br />Feel free to use these code snippets as is, as a model or not at all.<br /><br />Alternatively we could have parameter settings in the component to assign a menu item to each of the various views.</p>
IP Logged
 Subject :Re:Itemid on tags links to allow module placement on com_tag views.. 2009-10-19 02:12:03 
ewel
Apprentice
Joined: 2009-10-19 07:29:45
Posts: 2
Location
<p>I am not very good at reading code relating to menus and itemids, but am I understanding it right that this will take the itemid (if any) from the menu item for the page with all tags (if any) or otherwise of whatever menu item is active?</p>
IP Logged
 Subject :Re:Itemid on tags links to allow module placement on com_tag views.. 2011-03-11 15:39:50 
Slosh3719
Apprentice
Joined: 2011-03-11 22:37:08
Posts: 1
Location
<p>I just tested this and ran into a small error.</p>
<p> </p>
<p>With SEF turned on, the & before ItemID is removed, causing a page 404 error when you click a tag link in the plugin.</p>
<p> </p>
<p>Does anyone know what changes would need to be made in order to make this work with SEF on? It does work with SEF off.</p>
<p> </p>
<p>Thanks</p>
IP Logged
Page # 


Powered by ccBoard


Newsletter

Please subscribe to our newsletter to stay up-to-date with the latest news and release notifications delivered to your inbox.
Tags for Joomla



Joomla Plugin:ReadMoreExt