Include Joomla ItemID into links (hack included)
- lars.butveit
- Topic Author
- Offline
Less
More
- Posts: 89
- Thank you received: 4
12 years 2 months ago #1271
by lars.butveit
Include Joomla ItemID into links (hack included) was created by lars.butveit
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:Change to:
Remember to back up your original files first!
-Lars
www.Tamiyabase.com
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);
$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 to join the conversation.
- Dirk
- Offline
Less
More
- Posts: 1222
- Thank you received: 226
12 years 2 months ago #1277
by Dirk
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?
Replied by Dirk on topic Re: Include Joomla ItemID into links (hack included)
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 to join the conversation.
- lars.butveit
- Topic Author
- Offline
Less
More
- Posts: 89
- Thank you received: 4
12 years 2 months ago #1278
by lars.butveit
Replied by lars.butveit on topic Re: Include Joomla ItemID into links (hack included)
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.
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 to join the conversation.
- Dirk
- Offline
Less
More
- Posts: 1222
- Thank you received: 226
12 years 2 months ago #1279
by Dirk
Replied by Dirk on topic Re: Include Joomla ItemID into links (hack included)
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.
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 to join the conversation.
Moderators: Dirk, joest