Forums

Joomla 2.5 Menu Item Title not displaying in Form

carmbo 11 Dec, 2012
I'm using Joomla 2.5. I have my menu item named Contact linked to a ChronoForms form.
How can I get the Title of the Menu Item to display on the page as it does the menu item pages that are linked to articles? I already have Show Page Header selected in the menu item options.

Carmbo
carmbo 11 Dec, 2012
Thanks Bob.
I was actually talking about the title of the Menu item appearing
on the actual page above the content. Joomla seems to put it on
Article pages linked to Menu items but not on the ChronoForms form
linked to my Menu item.

Carmbo
GreyHead 12 Dec, 2012
Hi Carmbo,

Sorry, I misunderstood. I've never tried to do that. It must be possible though. You could check to see if Joomla! has a class to handle this; or grab the ItemId from the URL (ChronoForms will have put it into $form->data['ItemId'] and use a DB Record Loader, or hand-code a MySQL query to get the title.

Bob

PS I just took a quick look at the article code and this may do it in a Custom Code action:
<?php
$app = JFactory::getApplication();
$menus = $app->getMenu();
// Because the application sets a default page title,
// we need to get it from the menu item itself
$form->data['menu_title'] = '';
$menu = $menus->getActive();
if ( $menu ) {
  $form->data['menu_title'] =& $menu->title;
}
?>
Then you can use {menu_title} in a Heading or Custom Element element.

Bob
This topic is locked and no more replies can be posted.