17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2500 Views |
-
Get current page with a fixed menu structure?

12 August 2008 at 8:15am
I'm new to SS and working on converting an existing site for use with the CMS. The site design involves a graphical menu bar across the top which uses separate images for each menu item. For simplicity's sake I'm inclined to leave it this way (at least for now) and just change the links to point to the relevant SS top-level pages. However, I need to be able to figure out which menu item is the current page and display a different image in the menu bar. Currently this is done by simply having a different HTML file for each page and hard-coding the images, but obviously I don't want to do that.
The <% if LinkCurrent = current %> doesn't seem to work without the SS menu control structure, so is there some other way to do this?
-
Re: Get current page with a fixed menu structure?

12 August 2008 at 8:56am
You can use $URLSegment, this returns the part of the url of the page you are on. You could also add a custom identification field to your pageclass and use that to identify the current page.
-
Re: Get current page with a fixed menu structure?

12 August 2008 at 9:02am
if I have to do a site with graphical navigation what I normally do is in the menu control (nice bits cut out for briefness)
<% control Menu(1) %>
<img src="{$URLSegment}nav.gif" alt="$Title" />
<% end_control %>So if you have a Blog page with a URL of blog your blog image should be blognav.gif and blognavCurrent. Then what you could do if you want to swap the images on the current page is
<% control Menu(1) %>
<% if LinkOrSection = section %>
<img src="{$URLSegment}navCurrent.gif" alt="$Title" />
<% else %>
<img src="{$URLSegment}nav.gif" alt="$Title" />
<% end_control %>Thats just one of the ways you could do it.
-
Re: Get current page with a fixed menu structure?

12 November 2008 at 9:45am
When I use
<% control Menu(1) %>
<% if LinkOrSection = section %>
<img src="themes/purplewine/images/menu/{$URLSegment}nav.gif" alt="$Title" />
<% else %>
<img src="themes/purplewine/images/menu/{$URLSegment}navCurrent.gif" alt="$Title" />
<% end_control %>The website returns a blank screen. I can save in the CMS with no errrors.
<% control Menu(1) %>
<img src="themes/purplewine/images/menu/{$URLSegment}nav.gif" alt="$Title" />
<% end_control %>Works fine.
The problem seems to be caused when I add <% if LinkOrSection = section %> but I can see nothing wrong with this syntax and I am getting no error messages. Am new to this so it might be something obvious. Would appreciate any suggestions
MM
-
Re: Get current page with a fixed menu structure?

12 November 2008 at 10:15am
Ignore this question ... must be a newbie error. All working fin now.
MM
-
Re: Get current page with a fixed menu structure?

12 November 2008 at 10:16am Last edited: 12 November 2008 10:17am
You're missing an <% end_if %>
edit: but you beat me to it
| 2500 Views | ||
|
Page:
1
|
Go to Top |



