Swapping out SWFs based on page

Permalink 1 user found helpful
My latest C5 implementation is well underway! Woot!

The client provided 5 SWFs that they want swapped out depending on the page the user is on. I used collectionHandle to detect the name of the page and change the SWF name. If the handle doesn't exist in my list, I set a default file name. No problem!

However, there's a careers section. The header swaps to the careers.swf file just fine, but sub pages that contain actual open position content go back to default.swf. What's the best way to check to see if a page is a child of the careers page?

Thanks!

Darkwater23
 
elyon replied on at Permalink Reply
elyon
Here's some code I wrote for a site I built that should be helpful.

$nh = Loader::helper('navigation'); 
$breadcrumbs = $nh -> getTrailToCollection ($c);
$breadcrumbCount = count ($breadcrumbs);
if ($breadcrumbCount == 0) {
   $themeColor = "Multi-Color";
} else {
   if ($breadcrumbCount == 1) {
      $currentSection = $c -> getCollectionName ();
   } else {
      $currentSection = $breadcrumbs[$breadcrumbCount - 2] -> getCollectionName ();
   }
   switch ($currentSection) {
      case "About":
         $themeColor = "Blue";
      break;


You can see the live example here:

http://www.portlandbiblecollege.org...


The code is setting the theme color based on the section it is under. You could use this same principle to set the SWF
hursey013 replied on at Permalink Reply
hursey013
eylon - wanted to make sure I thanked you for this code snippet, I'm using it on a site and it works great! thank you!