Mercurial > defr > templates
comparison blog.php @ 13:673d9845fc16
Ajout d'un exemple plus complet basé sur DualBlog
| author | Franck Deroche <webmaster@defr.org> |
|---|---|
| date | Mon, 22 Oct 2007 08:59:58 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 12:8a99fa4ea193 | 13:673d9845fc16 |
|---|---|
| 1 <?php | |
| 2 require_once('class.template.php'); | |
| 3 $tpl = new Template('blog_index.xml'); | |
| 4 $p1 = new Template('blog_post.xml'); | |
| 5 $p1->setParams(array( | |
| 6 '#post@class' => 'PostContent Weird', | |
| 7 'postTitle' => 'Lorem ipsum', | |
| 8 'postDate' => 'lundi 19 mars 2007, 00h37', | |
| 9 '#mood@src' => '/blog/mood/Weird.png', | |
| 10 '#mood@alt' => 'Mood: Weird', | |
| 11 'postContent' => 'Lorem ipsum sit dolor amet', | |
| 12 'postTags' => 'Voyage, Toulon, SNCF', | |
| 13 'postNumber' => '#0002', | |
| 14 'postComments'=> 'Un petit commentaire ?' | |
| 15 )); | |
| 16 $p2 = new Template('blog_post.xml'); | |
| 17 $p2->setParams(array( | |
| 18 '#post@class' => 'PostContent Cool', | |
| 19 'postTitle' => 'Sit dolor', | |
| 20 'postDate' => 'samedi 17 mars 2007, 00h37', | |
| 21 '#mood@src' => '/blog/mood/Cool.png', | |
| 22 '#mood@alt' => 'Mood: Cool', | |
| 23 'postContent' => 'sit dolor amet', | |
| 24 'postTags' => 'Voyage, Toulon, SNCF', | |
| 25 'postNumber' => '#0001', | |
| 26 'postComments'=> 'Un petit commentaire ?' | |
| 27 )); | |
| 28 $params = array( | |
| 29 'title' => 'Dual Blog', | |
| 30 'head' => array( | |
| 31 array( | |
| 32 'link@rel' => 'StyleSheet', | |
| 33 'link@href' => '/css/truc.css', | |
| 34 'link@title' => 'Truc' | |
| 35 ), | |
| 36 array( | |
| 37 'link@rel' => 'Alternate StyleSheet', | |
| 38 'link@href' => '/css/chose.css', | |
| 39 'link@title' => 'Chose' | |
| 40 ) | |
| 41 ), | |
| 42 '#Posts' => array( | |
| 43 array('post' => $p1), | |
| 44 array('post' => $p2) | |
| 45 ) | |
| 46 ); | |
| 47 $tpl->setParams($params); | |
| 48 echo $tpl; | |
| 49 ?> |
