'In Segments', 'pi_version' => '1.0', 'pi_author' => 'Brian Litzinger', 'pi_author_url' => 'http://www.brianlitzinger.com/ee/', 'pi_description' => 'Checks to see if value is present in any segment.', 'pi_usage' => In_segments::usage() ); class In_segments { var $return_data = false; function In_segments() { global $IN, $TMPL; $value = $TMPL->fetch_param('value'); $exact = $TMPL->fetch_param('exact') == 'y' ? true : false; $return_segment = $TMPL->fetch_param('return_segment') == 'y' ? true : false; if(!$value) { echo 'Please enter a value to look for in the segments.'; } $i = 0; foreach($IN->SEGS as $segment) { if($exact) { if($value == $segment or in_array($segment, explode('|', $value))) { $this->return_data = ($return_segment) ? $i : true; } } else { $values = explode('|', $value); if(count($values) > 0) { foreach($values as $value) { if(strstr($segment, $value)) { $this->return_data = ($return_segment) ? $i : true; break; } } } else { if(strstr($segment, $value)) { $this->return_data = ($return_segment) ? $i : true; break; } } } $i++; } return $this->return_data; } function usage() { ob_start(); ?> See if a word exists in any segment, or is an exact segment match. If URL is mysite.com/giving-birth-here/your-team/nurses-staff/, then the following if statement will return true. {if "{exp:in_segments value='staff'}"} {embed="global/_staff_list" category="4"} {if:else} {embed="global/_staff_list" category="5"} {/if} Parameters ------------------ value= (required) the string of text you're searching for. Can be a pipe delimiated list that will search for multiple words in segemnt. If any of the words are found, it will return true. exact= (optional) set to'y' to do an exact segment match. In the example above only 'nurses-staff' would return as true. return_segment= (optional) set to 'y' to return the segment number in which the match was found. By default the plugin returns true/1 or false/0.