Smarty Templates

1,475 views

Published on

This was used by Mike Inman, a computer science major at Plymouth State University to present smarty templates to the class. If you would like to use smarty templates, check out http://www.smarty.net/ for more information.

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,475
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
118
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Smarty Templates

  1. 1. Mike Inman
  2. 2. Smarty Templates <ul><li>What is a template? </li></ul><ul><li>Why is it useful? </li></ul>
  3. 3. The Basics <ul><li>$smarty->assign(‘var’,’Hello World’) is $var = ‘Hello World’; </li></ul><ul><li>{$var} is echo $var; </li></ul><ul><li>Basic Example </li></ul>
  4. 4. Logic in Smarty <ul><li>{if},{elseif},{else} </li></ul><ul><li>{section} </li></ul><ul><li>{foreach} </li></ul><ul><li>{php}? </li></ul><ul><li>Logic Form Example </li></ul>
  5. 5. Playing with variables <ul><li>{$var|capitalize:true} </li></ul><ul><li>{$var|upper} </li></ul><ul><li>{$var|strip_tags:true} or{$var|strip_tags:false} </li></ul><ul><li>{$var|spacify}, {$var|spacify:”^^”} </li></ul><ul><li>Variable Examples </li></ul>
  6. 6. Adding a function <ul><li>Plugins </li></ul><ul><li>{include} </li></ul><ul><li>Modifiers </li></ul><ul><li>Eightball </li></ul>
  7. 7. Going beyond the template <ul><li>Compilation </li></ul><ul><li>Caching </li></ul>
  8. 8. PHP Compilation? <ul><li>Not binary compilation </li></ul><ul><li>Templates parsing </li></ul><ul><li>Not manual </li></ul>
  9. 9. Caching <ul><li>How is this useful? </li></ul><ul><li>How is this not? </li></ul><ul><li>$caching </li></ul><ul><li>$caching_lifetime </li></ul>
  10. 10. Resources <ul><li>http://www.smarty.net/ </li></ul><ul><li>http://www.sitepoint.com/article/smarty-php-template-engine/ </li></ul><ul><li>http://www.php-editors.com/smarty_manual/what.is.smarty.html </li></ul><ul><li>http://smarty.incutio.com/?page=SmartyFrequentlyAskedQuestions </li></ul><ul><li>http://www.smarty.net/manual/en/ </li></ul><ul><li>http://www.php-editors.com/smarty_manual/plugins.functions.html </li></ul>

×