Differences

This shows you the differences between two versions of the page.

quickstart [2013/01/11 10:04]
86.120.197.200
quickstart [2014/04/05 02:52] (current)
81.187.95.96 old revision restored
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 40: Line 40:
foreach($result_array as $k => $v) $phptal->set($k,$v);</code> foreach($result_array as $k => $v) $phptal->set($k,$v);</code>
-   ===== Layout template ======+===== Layout template ======
''[[http://phptal.org/manual/en/split/phptal-blocks.html|<tal:block>]]'' is an invisible element you can use anywhere. It's useful when you want some TAL functionality, but don't want to litter markup with unnecessary ''<div>'' or ''<span>''. ''[[http://phptal.org/manual/en/split/phptal-blocks.html|<tal:block>]]'' is an invisible element you can use anywhere. It's useful when you want some TAL functionality, but don't want to litter markup with unnecessary ''<div>'' or ''<span>''.
Line 59: Line 59:
<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>  
-  &amp;lt;body> +  <body> 
-    <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>