Using PHP to switch images on my menus.

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
aeoluo
New Member
New Member
Posts: 3
Joined: Thu Apr 14, 2011 12:12 am

Using PHP to switch images on my menus.

Post 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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Using PHP to switch images on my menus.

Post 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...
aeoluo
New Member
New Member
Posts: 3
Joined: Thu Apr 14, 2011 12:12 am

Re: Using PHP to switch images on my menus.

Post 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?
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: Using PHP to switch images on my menus.

Post 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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Using PHP to switch images on my menus.

Post 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
aeoluo
New Member
New Member
Posts: 3
Joined: Thu Apr 14, 2011 12:12 am

Re: Using PHP to switch images on my menus.

Post 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.
Post Reply

Return to “Layout and Design (CSS & HTML)”