PHPTAL introduction

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    PHPTAL introduction - Presentation Transcript

    1. PHPTAL Prasad Sep 11, 2009
    2. What is PHPTAL?
      • Template Attribute Language
    3. Advantages
      • Simple to use
      • Enforces separation between logic and presentation
      • Quite clean and readable templates,
        • presentation actions inside XHTML attributes
      • Generation of XHTML
      • Easier to extend and customize
    4. Disadvantages
      • You'll have to produce clean XHTML !
    5. <?php include_once 'PHPTAL/PHPTAL.php'; $phptal = new PHPTAL( 'markupfile.html' ); $phptal->set( 'PAGE_TITLE', 'PHPTAL - introduction'); $phptal->set( 'NUMBERS', array(10,20,30,40)); try { echo $phptal->execute(); } catch(Exception $e) { echo $e; } ?> <!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;> <html> <head> <title tal:content=”PAGE_TITLE” ></title> </head> <body> <table> <tr tal:repeat=”NUMBER NUMBERS” > <td tal:content=”NUMBER” ></td> </tr> </table> </body> </html>
    6. <!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;> <html> <head> <title> PHPTAL - introduction </title> </head> <body> <table> <tr> <td>10</td> </tr> <tr> <td>20</td> </tr> <tr> <td>30</td> </tr> <tr> <td>40</td> </tr> </table> </body> </html>
    7. <?php include_once 'PHPTAL/PHPTAL.php'; $phptal = new PHPTAL( 'markupfile.html' ); $phptal->set( 'PAGE_TITLE', 'PHPTAL - introduction'); $phptal->set( 'DATAGEN', new MyClass()); try { echo $phptal->execute(); } catch(Exception $e) { echo $e; } ?> <!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;> <html> <head> <title tal:content=”PAGE_TITLE” ></title> </head> <body> <div tal:content=” php: DATAGEN.getContent() ” tal:condition=” php: DATAGEN->checkAccess() ”></div> </body> </html> <?php class MyClass { function checkAccess() { return true; } function getContent() { return “PHPTAL is simple!”; } } ?>
    8. <!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;> <html> <head> <title> PHPTAL - introduction </title> </head> <body> <div>PHPTAL is simple!</div> </body> </html>
    9. <head metal:define-macro=”headerSection” > <title>PHPTAL - Macro</title> </head> <div metal:define-macro=”footerSection” > <p>Footer is not unless used.</p> </div> <!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;> <html> <head metal:use-macro=”Macro.html/headerSection” > <title>This will be over-written</title> </head> <body> <p> Head section is included via macro! </p> </body> </html> Macro.html
    10. <!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;> <html> <head> <title> PHPTAL - Macro </title> </head> <body> <p> Head section is included via macro! </p> </body> </html>
    11. <!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;> <html> <head> <title i18n:translate=”” >PHPTAL</title> </head> <body> <p i18n:translate=”LBL_BODY_CONTENT” > Placehodler content. </p> </body> </html>
      • SetTranslator for PHPTAL
      • Implement PHPTAL/PHPTAL/TranslationService.php

    + '""> '""> , 2 months ago

    custom

    233 views, 1 favs, 0 embeds more stats

    Smarter than smarty ;)

    More info about this document

    CC Attribution License

    Go to text version

    • Total Views 233
      • 233 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 1
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories