PHPTAL engine does not allow defines

jhriggs - February 20, 2007 - 15:12
Project:PHPTAL theme engine
Version:5.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

The PHPTAL theme engine does not allow themers to define constants that alter the behavior of PHPTAL (i.e. PHPTAL_FORCE_REPARSE, PHPTAL_PHP_CODE_DESTINATION, etc.). This is because PHPTAL.php is included before it is actually needed (right at the beginning of phptal.engine). This makes it impossible, for instance, to change the intermediate php file directory from its default of /tmp/ which I do not allow with openbasedir restrictions.

The attached patch moves the require_once of PHPTAL.php to _phptal_render() where it is actually needed. By doing this, a theme can define applicable constants in template.php.

AttachmentSize
phptal-moverequire.patch810 bytes

#1

moshe weitzman - February 20, 2007 - 15:37

sounds reasonable.

@jhriggs - i would love if you described a little bit on your blog or elsewhere how this theme engine is working for you. i am getting close to actually launching real sitex with it. want to know some pitfalls or success stories.

#2

jhriggs - February 20, 2007 - 17:32

@moshe - Heh. Well, actually, I just started using it this morning as I was getting completely frustrated with the messiness of all of the embedded php code in phptemplate. So, I don't have a lot of experience yet, but now that the phptemplate theme I was working on has been converted, it works perfectly. No noticeable speed difference, and my page.tal file is half the length of page.tpl.php (fits on a single emacs screen!), it is easier to read, I can edit it in html mode, and I can preview it outside of Drupal or any php.

This is the only bug I've really had to chase, and it was a simple enough fix. Based on my experience so far, I plan on moving all of my themes.

#3

olav - February 20, 2007 - 21:42
Status:reviewed & tested by the community» fixed

Jim,

thank you for the patch which I have just applied.

Moshe, recent sites we have done with the phptal engine is http://robocup-german-open.de/ and its sub-site http://robocup-german-open.de/magdeburg/ - absolutely no problems here.

Another large site we have done lately is http://sputnik.de. Although using another CMS, all the templating is done using PHPTAL. We used a Subversion repository to sync with the design agency; they could view their markup and example content as static files while we added CMS based stuff to it - really smooth workflow and fun, too.

-- Olav

#4

Anonymous - March 6, 2007 - 21:45
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.