changeset 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 8a99fa4ea193
children 54b0a41e5564
files blog.php blog_index.xml blog_post.xml
diffstat 3 files changed, 85 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/blog.php	Mon Oct 22 08:59:58 2007 +0200
@@ -0,0 +1,49 @@
+<?php
+  require_once('class.template.php');
+  $tpl = new Template('blog_index.xml');
+  $p1 = new Template('blog_post.xml');
+  $p1->setParams(array(
+    '#post@class' => 'PostContent Weird',
+    'postTitle'   => 'Lorem ipsum',
+    'postDate'    => 'lundi 19 mars 2007, 00h37',
+    '#mood@src'   => '/blog/mood/Weird.png',
+    '#mood@alt'   => 'Mood: Weird',
+    'postContent' => 'Lorem ipsum sit dolor amet',
+    'postTags'    => 'Voyage, Toulon, SNCF',
+    'postNumber'  => '#0002',
+    'postComments'=> 'Un petit commentaire ?'
+  ));
+  $p2 = new Template('blog_post.xml');
+  $p2->setParams(array(
+    '#post@class' => 'PostContent Cool',
+    'postTitle'   => 'Sit dolor',
+    'postDate'    => 'samedi 17 mars 2007, 00h37',
+    '#mood@src'   => '/blog/mood/Cool.png',
+    '#mood@alt'   => 'Mood: Cool',
+    'postContent' => 'sit dolor amet',
+    'postTags'    => 'Voyage, Toulon, SNCF',
+    'postNumber'  => '#0001',
+    'postComments'=> 'Un petit commentaire ?'
+  ));
+  $params = array(
+    'title' => 'Dual Blog',
+    'head' => array(
+       array(
+        'link@rel'   => 'StyleSheet',
+       	'link@href'  => '/css/truc.css', 
+	'link@title' => 'Truc'
+       ),
+       array(
+        'link@rel'   => 'Alternate StyleSheet',
+        'link@href'  => '/css/chose.css', 
+	'link@title' => 'Chose'
+       )
+    ),
+    '#Posts' => array(
+      array('post' => $p1),
+      array('post' => $p2)
+    )
+  );
+  $tpl->setParams($params);
+  echo $tpl;
+?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/blog_index.xml	Mon Oct 22 08:59:58 2007 +0200
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:tr="http://defr.net/2007/template">
+ <head>
+  <title />
+  <link rel='StyleSheet' type='Text/CSS' href='/blog/css/comment.css' />
+  <link tr:toClone='true' type='text/css' media='screen' />
+  <link rel="alternate" type="application/atom+xml" title="Atom feed" href="/blog/dualblog.atom" />
+  <link rel="alternate" type="application/rss+xml" title="RSS 2.0 feed" href="/blog/dualblog.rss" />
+  <meta http-equiv='content-type' content='text/html; charset=utf-8' />
+  <meta name='author' content='Franck Deroche' />
+ </head>
+
+ <body id="Main">
+  <h1>Dual Blog : DeFr's Weblog</h1>
+  <div id="Posts" tr:id='Posts'>
+   <tr:post tr:toClone='true' />
+  </div>
+ </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/blog_post.xml	Mon Oct 22 08:59:58 2007 +0200
@@ -0,0 +1,16 @@
+<?xml version='1.0' encoding='utf-8'?>
+<div class='PostContent Weird' 
+	xmlns='http://www.w3.org/1999/xhtml' 
+	xmlns:tr='http://defr.net/2007/template'
+	tr:id='post'>
+	<h2><tr:postTitle /> | <span class='Date'><tr:postDate /></span></h2>
+	<img tr:id='mood' class='mood' />
+	
+	<tr:postContent />
+
+        <p class='postInfos'>
+	<span class='Tags'><em>Tags</em> : <tr:postTags /></span><br />
+	<a href="/blog/posts/321-Une_nuit_en_Corail_Lunea"><tr:postNumber /></a> - 
+	<a href="/blog/posts/321-Une_nuit_en_Corail_Lunea"><tr:postComments /></a>
+	</p>
+</div>