Link to home
Start Free TrialLog in
Avatar of Morgan
Morgan

asked on

Customize joomla menu title and position with CSS

I am wanting to know if there is a way to place the title of a joomla menu in a specific place.
I know I can use:

<?php echo $this->title; ?>

to show the title of an article and place it anywhere on the page to show it.

Is there a similar way for titles of menus?

Essentially, I am wanting to place the menu title between the <h4></h4> tags that are defined within the CSS file.

Thanks,

neonate
Avatar of Allan Nisbet
Allan Nisbet
Flag of United Kingdom of Great Britain and Northern Ireland image

You could have a look at the menu plugin for joomla and take the code for menu name out of the php file.

Storm
Maybe this code will help

<?php
  if ($module->showtitle)
  {
    echo '<h2>' .$module->title .'</h2>';
  }
?>
Avatar of Morgan
Morgan

ASKER

Storm:

The posted code did not work :(. What menu plugin for joomla do you speak of?
ASKER CERTIFIED SOLUTION
Avatar of Allan Nisbet
Allan Nisbet
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Morgan

ASKER

Storm:

Sorry for getting back late. busy busy busy.

Anyway...

I've gone to the link you provided--Thanks!--and I have made changes but I'm still not able to get the title to show.  I'm thinking that my code is just not right.

Code below:
<div id="menu1-top">
                			<?php if ($this->countModules( 'user2' )) :  ?>
  								<?php echo '<h4>' .$module->title .'</h4>';	?>
							<?php endif; ?>
                    </div>
                    <div id="menu1-content">
                    	<div class="menu-content">
                    		<jdoc:include type="modules" name="user2" />      
                        </div>
                    </div>
                    <div id="menu1-bottom">
                    </div>

Open in new window

Avatar of Morgan

ASKER

Storm:

Alright after some more playing around I got it :)

I appreciate your help!

The working code is below.
<div id="menu1-top">
<h4>
<?php if ($this->countModules( 'user2' )) :  ?>
<?php $module->title;	?>
<?php endif; ?>
</h4>
</div>
<div id="menu1-content">
<div class="menu-content">
<jdoc:include type="modules" name="user2" style="xhtml" />      
</div>
</div>
<div id="menu1-bottom">
</div>

Open in new window

Avatar of Morgan

ASKER

Thank you!
Avatar of Morgan

ASKER

I would like correct the earlier code. The code I posted above actully did not work at--I made an error in what I beleived to be correct, but unfortently was not.

To render the title of a menu as I wanted i need to go a bit further: the is acutally found here:

http://woofandwarp.com/blog/2-joomla/19-having-fun-with-joomla-module-chrome-and-suffix

The code I used within the modules.php file (explained in the above link) was this (the following code is my own custom code to corrospond with my CSS styling:

function modChrome_modheader($module, &$params, &$attribs)
{
echo '<h4>'.JText::_( $module->title). '</h4>';
echo '<div class="moduletable">'.$module->content.'</div>';
}
?>

I then had to go to the index.php file and change the style attribut within module call to this:

<jdoc:include type="modules" name="user1" style="modheader" />

I had to make a few minor changes within my css to position my my title where I wanted, but now I have officially corrected the code.