I anm having trouble with the $primary_links variable in the chameleon theme. The print out is link | link | link | link so you would think you could do this:

 $arrPrimaryLinks = split("|",$primary_links);
	  foreach ($arrPrimaryLinks as $value) { 
   		$output .= '<div class="primary_link_node">'. $value .'</div>';
		} 

But the regex comes up empty and does not set an array. What am I missing here?

Comments

carlmcdade’s picture

Split does not work but explode does. Another PHP5 quirk or did I miss something in the PHP docs?

But anyway I have another question. Where are the bars "|" coming from in the string? I did search after search but could not find them in any code.

Carl McDade
Information Technology Consult
Team Macromedia
www.heroforhire.net

killes@www.drop.org’s picture

function theme_links($links, $delimiter = ' | ') {
--
If you have troubles with a particular contrib project, please consider to file a support request. Thanks.

Steven’s picture

Split uses a regular expression as its syntax. "|" is a special regular expression character for OR ing two regexps. In any case, you don't need dynamic delimiters, so a regular string-based explode is better.

carlmcdade’s picture

I am embarassed. I had not thought that "|" would have to be escaped.

Thanks for the kick in the neurons.

Carl McDade
Information Technology Consult
Team Macromedia
www.heroforhire.net