Page 1 of 1

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

Posted: Thu Jun 28, 2012 7:21 pm
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

Re: Using {$position} to load correct images

Posted: Sun Jul 01, 2012 12:58 am
by Dr.CSS
Maybe a bit more detail in what you are trying to do would help?...

Re: Using {$position} to load correct images

Posted: Sun Jul 01, 2012 7:06 am
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

Re: Using {$position} to load correct images

Posted: Sun Jul 01, 2012 5:14 pm
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)}

Re: Using {$position} to load correct images

Posted: Mon Jul 02, 2012 12:55 pm
by Recon
Thank You,

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

-R