Reputation: 241
I have a main menu. Each menu item is link to an article.
Now on the complete site there are many places in the components and modules where I need to show two links : Privacy Policy & Portfolio.
Can someone please guide me? I do not want to hard code the links as the item id would differ in production.
Upvotes: 1
Views: 520
Reputation: 160
try with this
<?php
$menuitemid = JRequest::getInt( 'Itemid' );
if ($menuitemid)
{
$menu = JSite::getMenu();
$menuparams = $menu->getParams( $menuitemid );
$params->merge( $menuparams );
}
$propvalue= $params->get('property_name');
?>
Upvotes: -1
Reputation: 19743
You could use a database query like so:
<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*')
->from('#__menu')
->where('id = 435 OR id = 466');
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as $row) {
echo '<a href="' . JRoute::_($row->link) . '">' . $row->title . '</a>';
}
?>
Don't forget to change the ID's 435
and 466
to the ID's of your own menu items:
Hope this helps
Upvotes: 2