Hi Guys,
I just wanted to ask if you guys knew of a cool way to have a snippet in the header which displays a different banner image depending on what folder the content is in. Each parent folder has a banner image created for it, and all of its children show that banner image.
for example
cars (folder)
- holden (shows the ’cars’ banner at the top)
- ford (shows the ’cars’ banner at the top)
engines
- V4 (shows the ’engines’ banner at the top)
- V6 (shows the ’engines’ banner at the top)
thanks for your help guys!
Nicholas
Not the most elegant solution and untested but this may work
<?php
// sample parent folder numbers used later
// cars_pageid = 4
// engines_id = 5
$output ="";
$current_pageid = $modx->documentIdentifier;
$current_pageid_parent =$modx->documentObject['parent'];
// change these samples to the ids of your parent documents
if($current_pageid == "4" || $current_pageid_parent == "4"){
$output .="<img src='path/to/your/cars/image' alt=''>";
}
if($current_pageid == "5" || $current_pageid_parent == "5"){
$output .="<img src='path/to/your/engines/image' alt=''>";
}
return $output;
?>
breezer and bunk58 thank you guys very much for helping me with this one.
have a good one!