This shows you the differences between two versions of the page.
quickstart [2010/07/28 09:31] 88.246.55.101 test |
quickstart [2014/04/05 02:52] (current) 81.187.95.96 old revision restored |
||
---|---|---|---|
Line 2: | Line 2: | ||
===== Basics ===== | ===== Basics ===== | ||
- | - [[http://phptal.org/download.html|Download]] oldest version | + | - [[http://phptal.org/download.html|Download]] latest version |
- Unpack it in your project or includes directory | - Unpack it in your project or includes directory | ||
- Create PHP and template files | - Create PHP and template files | ||
- | ''index.php.php'': | + | ''index.php'': |
<code php><?php | <code php><?php | ||
Line 27: | Line 27: | ||
===== Gathering of data ===== | ===== Gathering of data ===== | ||
- | This is not a requirement, but good advice: avoid passing PHPTAL object (or template abstraction wrapper) around your entire program. MVC programs should be independent of their views (metal exercise: would your application break if there was no view?). | + | This is not a requirement, but good advice: avoid passing PHPTAL object (or template abstraction wrapper) around your entire program. MVC programs should be independent of their views (mental exercise: would your application break if there was no view?). |
Instead of setting variables directly on PHPTAL object, make your methods //return// all required information. You can also pass helper objects to PHPTAL which will load data on demand. | Instead of setting variables directly on PHPTAL object, make your methods //return// all required information. You can also pass helper objects to PHPTAL which will load data on demand. | ||
Line 55: | Line 55: | ||
</div></code> | | </div></code> | | ||
- | <testing></testing> | + | ''main.xhtml'': |
- | ''main.xhtml'': | + | |
<code xml> | <code xml> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
- | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | + | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\\ |
- | <html xmlns="http://www.w3.org/1999/xhtml" metal:define-macro="layout"> | + | <html xmlns="http://www.w3.org/1999/xhtml" metal:define-macro="layout">\\ |
- | <head> | + | <head> |
- | <title tal:content="title"/> | + | <title tal:content="title"/> |
- | <tal:block metal:define-slot="other-stuff-in-head"/> | + | <tal:block metal:define-slot="other-stuff-in-head"/> |
- | </head> | + | </head> |
- | &lt;body> | + | <body> |
- | <div id = "yasin></div> | + | <div id="main"><tal:block metal:define-slot="maincontent"/></div>\\ |
- | <div id="main"><tal:block metal:define-slot="maincontent"/></div> | + | </body> |
- | </body> | + | </html> |
- | </html> | + | |
</code> | </code> | ||
Line 84: | Line 82: | ||
You don't have to fill all slots. Here ''main.xhtml'' defines ''other-stuff-in-head'' slot, which you could use e.g. for adding JavaScript or link to CSS, but you don't have to. | You don't have to fill all slots. Here ''main.xhtml'' defines ''other-stuff-in-head'' slot, which you could use e.g. for adding JavaScript or link to CSS, but you don't have to. | ||
- |