5098 Posts in 1518 Topics by 1115 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 979 Views |
-
Changing code based on Parent type

23 July 2009 at 11:57pm
My website has two distinct sections ("cars" and "bikes"), so I have made CarsHolder and BikesHolder page types with corresponding children. Each section has a different image. However, for pages which can't be CarsArticle or BikesArticle (ie User Defined Forms), I could do with some code to go onto Page.ss which will automatically select the correct image based upon the Parent page type.
ie: A User Defined Form with "CarsHolder" as it's parent will load an image of the car for its header.
I had hoped that something along the lines of the code below would work, but I don't know the correct code:
<% if $Parent = CarsHolder %>
<div id="carsheaderpic">Cars</div>
<% else %>
<div id="bikesheaderpic">Bikes</div>
<% end_if %>Any pointers greatly appreciated
-
Re: Changing code based on Parent type

31 July 2009 at 4:39pm
Maybe try something like this:
<% control Level(1) %>
<div id='Header' class='$ClassName'>$Title</div>
<% end_control %>the Level(1) control will get the root ancestor, so it'll work in sub sub pages where Parent won't. Just change the CSS to use BikesHolder and CarsHolder instead of bikesheaderpic carsheaderpic.
Just noticed this post is a bit late, but hopefully at least someone will find it helpful
| 979 Views | ||
|
Page:
1
|
Go to Top |


