. Updated Daily. Editions SDA India   SDA Indonesia
BUSINESS ENTERPRISE SOLUTIONS ARCHITECTURE INFORMATION SECURITY WIRELESS & MOBILITY DATA & STORAGE DEVELOPMENT HARDWARE













News

Wednesday, 2 May 2007

Learn to Use PHPTAL for Templates

 

 

Daniel Kvasnicka Jr. in the Bakery blog has written a PhptalView class. He is fond of XML and wanted to use in the CakePHP tutorial.

To facilite his fondness for XML, he designs a PhptalView class with the following steps:

  • Make sure you use PHP 5. PHPTAL is working only with PHP 5.
  • Download PHPTAL from http://phptal.motion-twin.com/ and unpack it in /app/vendors. His class will look for PHPTAL-1.1.8 directory, as this is the last version of PHPTAL. It's easy to customize the dirname by changing the vendor() statement. It should be possible to use PHPTAL from PEAR too. Try installing PHPTAL into your PEAR and load it with plain old require().
  • Download the snippet from CakeForge or from the second page of this article: http://cakeforge.org/snippet/detail.php?type=snippet&id=180
  • Place it in your /app/views directory
  • In your controller, set view to Phptal and he cites code examples for Controller class
  • Create templates and layouts with .zpt extension. In your layouts, and display the well known central variable as a structure
  • Assign variables as usual, through Cake's set() method.

 

Read the Post

 
 
print save email comment

print

save

email

comment

 
 

Search SDA Asia

Free eNewsletter

SDA Asia Magazine Free Download
 
 
 
Copyright @ 2009 SDA Asia Magazine - All Right Reserved Privacy Policy | Terms of Use