This forum is for assistance with theme development.

HOWTO: Allow php in primary links in xtemplate

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):

extending civicspace theme per page switching based on args strange behavior

i'm using the civicspace theme, i've extended the concept of how the admin area is switching to a different page-*.tpl.php's

Pushbutton Issue

Hi,

I use the pushbutton theme on my installation and it is working great. There is online one issue. The first line in a page or article is about 40 - 50 pixel pushed to the right. The next lines and the title are perfect aligned at the left. I looked over the css but can't find any specific tweak for this. I changed several margins and paddings in the 'node content' definition but it always moves the whole textblock including the title.
Has anybody had this problem before and knows the solution?

Thank you very much in advance
Wickus

.block

hi,

I can't find my problem so i'll try it on the forums here :P

I wan't that the blocks in my sidebar have a picture under them. (like they used in the theme "connections")

I found this in the css file:

menus - they don't seem to be working for me

I did a search and couldn't find anything on this. I'm having trouble getting the menu module that comes with drupal to work. A newly created menu will appear, but menu items don't. Has anyone else had this problem?

Drupal + Bluemarine ul bullets and Primary/Secondary Link separators.

Hello,

I've got two quick questions, customizing the bluemarine theme:

Click here for screenshot of what I'm trying to change.

1) Where can I change the bullets in unnumbered lists to not be that little black dot; and,

2) Where can I change the delimiter between primary and secondary links from the vertical bar "|" to something else?

tyia,

s.

Pages

Subscribe with RSS Subscribe to RSS - Theme development