Hello I am using this code:

    $active = JFactory::getApplication()->getMenu()->getActive();
    echo $active->title;

To show the current menu item title, but how can I make it linkable? So its a link and I can click it?


To get the link, you can simply use $active->link.

So based on your code, you can use the following:

$active = JFactory::getApplication()->getMenu()->getActive();
$title  = $active->title;
$url    = JRoute::_($active->link);

echo '<a href="' . $url . '">' . $title . '</a>';
  • works like a charm. simple and easy. thank you very much sir!
    – Peter
    Mar 16 '16 at 0:57
  • @Peter - Glad it helped :)
    – Lodder
    Mar 16 '16 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.