Code :
 - <!-- NAME: new_categ_main.tpl -->
 - <html>
 - <head>
 - 	<title>Ajouter une recette</title>
 - </head>
 - <body>
 - {LISTE}
 - </body>
 - </html>
 - <!-- END: new_categ_main.tpl -->
 
  | 
 
Code :
 - <!-- NAME: liste.tpl -->
 - <ul>
 - 	<!-- BEGIN DYNAMIC BLOCK: li -->
 - 	<li>{INGREDIENT}</li>
 -    <!-- END DYNAMIC BLOCK: li -->
 - </ul>
 - <!-- END: liste.tpl -->
 
  | 
 
 
Code :
 - <?
 - Header("Content-type: text/plain" );
 - include("./includes/class.FastTemplate.php" );
 - include("./includes/db_connect.php" );
 - $tpl = new FastTemplate("./templates" );
 - $tpl->define(
 - 	array(
 -   main    => "new_categ_main.tpl",
 -   liste   => "liste.tpl"
 - 	)
 - );
 - $tpl->define_dynamic("li", "liste" );
 - $recette_id = 0;
 - $sql = "SELECT ingredient FROM ingredients WHERE recette_id='$recette_id';";
 - $query = mysql_query($sql,$db) or die ('proutte');
 - while($result = mysql_fetch_row($query))
 - {
 - 	$Ingredient = $result[0];
 - 	$tpl->assign(
 -   array(
 -   	INGREDIENT	=>	$Ingredient
 -   )
 - 	);
 - 	$tpl->parse(LISTES,".li" );
 - }
 - $tpl->parse(MAIN, array("liste","main" ));
 - $tpl->FastPrint();
 - exit;
 - ?>
 
  | 
 
c'est dans les exemples de la doc, donc je suppose que ça fct
 
il va remplacer ton "li" dynamic par {LISTES} dans le template "liste"
-->
Code :
 - <!-- NAME: liste.tpl -->
 - <ul>
 - 	<!-- BEGIN DYNAMIC BLOCK: li -->
 -         {LISTES}
 -         <!-- END DYNAMIC BLOCK: li -->
 - </ul>
 - <!-- END: liste.tpl -->
 
  | 
 
il va concaténer la valeur du template "li" à la précédente et tout stocker dans {LISTES}.
LISTES= "<li>INGD1</li><li>INGD2</li>"
puis il remplace automatiquement {LISTES} par sa valeur lors du parsage $tpl->parse(MAIN, array("liste","main" ));
 
j'espère que tu as suivi 
 
Message édité par ethernal le 17-08-2002 à 11:52:04
 ---------------
			
...oups kernel error...