As webmaster of a website which runs drupal, I had to do a couple of tweaks with the help of this site and php.net to make it run the way I wanted it to. One of the most annoying things with the current template engine I'm using (xtemplate) is that it doesn't handle php through it's primary links. Thankfully for me, someone at php.net (Nick - SafireX; check out the actual post here: http://us2.php.net/manual/en/function.eval.php) created two functions that helps out a lot at fixing this problem. So here's what I did:
NOTE: This works for Drupal 4.6.5, I believe it should work for 4.6.6 as well
1. The two functions parses variables that contain html and php, and processes all the php:
function eval_mixed_helper($arr){
return ("echo stripslashes(\"".addslashes($arr[1])."\");");
}
function eval_mixed($string){
$string = "<? ?>".$string."<? ?>";
$string = preg_replace("/<\?=\s+(.*?)\s+\?>/", "<? echo $1; ?>", $string);
$string = str_replace('?>', '', str_replace( array('<?php', '<?'), '', preg_replace_callback( "/\?>((.|\n)*?)<\?(php)?/","eval_mixed_helper",$string) ) );
return eval($string);
}
Place these at the very bottom of your xtemplate.engine file (located in /themes/engines/xtemplate), right before the php closing tag
2. xtemplate just happens to use theme_get_setting() to grab primary_links html and place it on a page. If we were able to grab that html (which, hopefully would include some php) and run it though the functions, we'll have the workings of a full-blooded "php-enabled" primary_links. To do this, simply mod the following lines (starting from line 28-ish):