Page 1 of 1

Using PHP to switch images on my menus.

Posted: Thu Apr 14, 2011 12:23 am
by aeoluo
Hello everyone!

I've been working on getting my layout working with CMSMS and it's been working out great until I discovered that the tabbed menu style I had done in my html draft of my website doesn't work the way I want it to when coded in CMSMS. Originally I'd been using each independent .html file to change the image source to change the navigation picture but now that it's a global template I'm not sure how to go about doing that.

I wrote some PHP that I thought could fix my problem but it seems to be ignoring the "if" condition and defaulting on the link and image I specified after "else":

Code: Select all

{if $pageURL == 'index.php?portfolio'}
<a href="#"><img src="Images/ikont1/template/Nav_portfolio.png" width="69" height="32" border="0" /></a>
{else}
<a href="index.php"><img src="Images/ikont1/template/Nav_Portfolio_Tab.png" width="69" height="32" border="0" /></a>
{/if}
To give you a better idea of what I'm talking about visit the html version of my website here: www.eikonis.com
and the CMSMS version here: www.eikonis.com/css/

Any help figuring this out will be greatly appreciated!

Thanks,
~Chris

Re: Using PHP to switch images on my menus.

Posted: Thu Apr 14, 2011 12:57 am
by Dr.CSS
I never use text on image if I can help it, and believe me I can help it 99.99% of the time, for a quick tutorial of full image menus try this...

http://themes.cmsmadesimple.org/Howto/Image_menu.html

It may also help you to study some of the default themes that come with CMSMS like the ncleanblue...

Re: Using PHP to switch images on my menus.

Posted: Thu Apr 14, 2011 4:41 am
by aeoluo
Thanks for the feedback however I'm looking for images to change based on the page the user is on rather than a mouse over effect.

Any ideas?

Re: Using PHP to switch images on my menus.

Posted: Thu Apr 14, 2011 5:51 pm
by Nullig
You need to give the active page menu item a different class, so you can style it differently.

It doesn't look like you're using one of the supplied menu templates - what are you using to generate the menu?

Nullig

Re: Using PHP to switch images on my menus.

Posted: Thu Apr 14, 2011 6:14 pm
by Dr.CSS
It works best if you use a default menu template as they have li.menuactive classes that you would tell to have the background like this one does...

http://multiintech.com/defaultcontent/d ... ontal.html

Re: Using PHP to switch images on my menus.

Posted: Thu Apr 14, 2011 8:31 pm
by aeoluo
Nullig wrote:You need to give the active page menu item a different class, so you can style it differently.

It doesn't look like you're using one of the supplied menu templates - what are you using to generate the menu?

Nullig
Being new to using a cms to manage my website I simply wrote the menu buttons as normal html image links that pointed to the pages I made and put that in the global template.

Thanks again dr.css I think that will be the solution, i'll give it a try when I get home and let you know if that worked for me.