Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Include Joomla ItemID into links (hack included) 8 years 11 months ago #1271

  • lars.butveit
  • lars.butveit's Avatar Topic Author
  • Offline
  • Posts: 87
  • Thank you received: 4
The links from catalog view does not have a Joomla ItemID (menu item) included in the link, making it impossible to set custom modules for the JooDb databases.

The solution is to make the following hack:
The file joodb.php in folder /components/com_joodb/helpers:
Existing line 32:
$itemlink = JRoute::_('index.php?option=com_joodb&view=article&joobase='.$joobase->id.'&id='.$item->{$joobase->fid}.':'.JFilterOutput::stringURLSafe($item->{$joobase->ftitle}),false);
Change to:
$itemid = JRequest::getVar('Itemid');
$itemlink = JRoute::_('index.php?option=com_joodb&view=article&joobase='.$joobase->id.'&id='.$item->{$joobase->fid}.'&Itemid='.$itemid.':'.JFilterOutput::stringURLSafe($item->{$joobase->ftitle}),false);

Remember to back up your original files first!

-Lars
www.Tamiyabase.com

Please Log in or Create an account to join the conversation.

Re: Include Joomla ItemID into links (hack included) 8 years 11 months ago #1277

  • Dirk
  • Dirk's Avatar
  • Offline
  • Posts: 1185
  • Karma: 21
  • Thank you received: 224

lars.butveit wrote: The links from catalog view does not have a Joomla ItemID (menu item) included in the link, making it impossible to set custom modules for the JooDb databases.


Sorry Lars,

thank you for your suggestion. But at least joomla 2.5 automatically attaches an Itemid to the query.

Look at db-example.html .
There is no module at the right side. The Itemid is 138. As you see there is always the /db-example in the urls.

The $menu->getActive() command in the joodb route.php file gets the current menu. So no Itemid is needed.
[code type=php-brief]
if (empty($query)) {
$menuItem = $menu->getActive();
$menuItemGiven = false;
} else {
$menuItem = $menu->getItem($query);
$menuItemGiven = true;
}
[/code]

Can you tell me a concrete example where it does not work?

Please Log in or Create an account to join the conversation.

Re: Include Joomla ItemID into links (hack included) 8 years 11 months ago #1278

  • lars.butveit
  • lars.butveit's Avatar Topic Author
  • Offline
  • Posts: 87
  • Thank you received: 4
Hi,
Sorry for not mentioning it, I use Joomla 1.5.26.
My hack is running on my site now so I have the itemid's I need.

I discovered the problem when I started my second Joodb and wanted to have different modules shown on the two databases.

Note: I am not a programmer so my hack might be "crude", but it seem to work.

Please Log in or Create an account to join the conversation.

Re: Include Joomla ItemID into links (hack included) 8 years 11 months ago #1279

  • Dirk
  • Dirk's Avatar
  • Offline
  • Posts: 1185
  • Karma: 21
  • Thank you received: 224
Even with joomla 1.5 I am not able to recapitulate the problem. But I will insert an Itemid parameter in the next version.

Btw:
Don't take JRequest::getVar('Itemid'); use JRequest::getInt();

2:) As soon as Joomla version 3.5 is out you should think about updating your site, because we will stop support for 1.5 Joomla.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: Dirkjoest