[SOLVED]Using {$position} to load correct images

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
Recon
Forum Members
Forum Members
Posts: 200
Joined: Sat Oct 09, 2010 10:23 am

[SOLVED]Using {$position} to load correct images

Post by Recon »

Hi,

Is there better way to this? I have three level navigation, where second level is only section headers and third level is sub-navigation. I want to load different images to banner dependign on the second level.

Like this:

Code: Select all

{if $position eq "2.1.1" || $position eq "2.1.2" $position eq.....}
load image1
{elseif $position eq "2.2.1" || $position eq "2.2.2" $position eq.....}
load image2
{elseif $position eq "2.3.1" || $position eq "2.3.2" $position eq.....}
load image3
{/if}
-R
Last edited by Recon on Mon Jul 02, 2012 12:56 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Using {$position} to load correct images

Post by Dr.CSS »

Maybe a bit more detail in what you are trying to do would help?...
Recon
Forum Members
Forum Members
Posts: 200
Joined: Sat Oct 09, 2010 10:23 am

Re: Using {$position} to load correct images

Post by Recon »

I'll try :)

I need to get menu parent detail somehow and only variable for that what I have found is {$position}. I want to load different picture for every level2's "group" (every level 3 pages on that menu parent) like this:

three level navigation:

*level 1
**level2.1
***level3.1.1 (image1)
***level3.1.2 (image1)
***level3.1.3 (image1)
**level2.2
***level3.2.1 (image2)
***level3.2.2 (image2)
***level3.2.3 (image2)
**level2.3
***level3.3.1 (image3)
***level3.3.2 (image3)
***level3.3.3 (image3)


I could do this with examble what I show, but if -statement would be sooooooo long and I don't know numbers of the pages on level three.

-R
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Using {$position} to load correct images

Post by Dr.CSS »

This is something I would do in the style sheet using the parent page alias, the CGSimpleSmarty module...

</__body class='{$cgsimple->get_parent_alias()}'>

.level2.1alias div#banner {background: url(uploads/images/image.jpg)}

.level2.2alias div#banner {background: url(uploads/images/different_image.jpg)}
Recon
Forum Members
Forum Members
Posts: 200
Joined: Sat Oct 09, 2010 10:23 am

Re: Using {$position} to load correct images

Post by Recon »

Thank You,

works like I wanted. I haven't known that CGSimpleSmarty works like that, perfect.

-R
Post Reply

Return to “The Lounge”