[wp-hackers] PHPTAL integration into wordpress

Matt Patenaude MattPat at mattpat.net
Wed May 9 01:11:26 GMT 2007

Methinks it's doable-- I just integrated my own blogging engine with  
Smarty relatively easily, since you don't need to mess with your  
existing framework, just open up the parts you want to use to the  
template engine.

For instance, much of what I used to open to my themes was done  
through simply defining constants. I wrote a function that does  
something like this:

$constants = get_defined_constants(true);
$userConstants = $constants['user'];
$keys = array_keys($userConstants);
$length = count($keys);

for ($i = 0; $i < $length; $i++) {
	$smarty->assign($keys[$i], $userConstants[$keys[$i]]);

(This could also be easily accomplished with foreach ($constants as  
$key => $constant), but I chose this method for a bit of improved  
speed). Also, $smarty.const.constantName lets you access constants  
directly, I just prefer the shorter {$constantName} syntax.

Like I said, you will have to put some work into it, but since you  
don't need to change anything in the WordPress core, it's doable  
without killing yourself and/or draining a local 7-11 of their supply  
of caffeinated beverages. ;)


On May 8, 2007, at 9:01 PM, Bertrand wrote:

> Hi,
> I want to integrate PHPTAL templates into Wordpress for part of a  
> larger project.
> Will this be possible without breaking my back? How hard would it  
> be to integrate Smarty, for example?
> Any advice appreciated.
> B
> PHPTAL: http://phptal.motion-twin.com/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list