| 
									
										
										
										
											2004-04-13 11:47:32 +00:00
										 |  |  |  | <?xml version="1.0" encoding="iso-8859-1"?> | 
					
						
							|  |  |  |  | <!-- $Revision$ --> | 
					
						
							| 
									
										
										
										
											2005-12-05 21:15:38 +00:00
										 |  |  |  | <!-- EN-Revision: 1.8 Maintainer: yannick Status: ready --> | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-12-26 17:02:12 +00:00
										 |  |  |  | <refentry id="api.template.exists"> | 
					
						
							|  |  |  |  |  <refnamediv> | 
					
						
							| 
									
										
										
										
											2005-12-05 21:15:38 +00:00
										 |  |  |  |   <refname>template_exists()</refname> | 
					
						
							|  |  |  |  |   <refpurpose>V<EFBFBD>rifie si un template sp<73>cifique existe</refpurpose> | 
					
						
							| 
									
										
										
										
											2004-12-26 17:02:12 +00:00
										 |  |  |  |  </refnamediv> | 
					
						
							|  |  |  |  |  <refsect1> | 
					
						
							| 
									
										
										
										
											2005-12-05 21:15:38 +00:00
										 |  |  |  |   <title>Description</title> | 
					
						
							| 
									
										
										
										
											2004-12-26 17:02:12 +00:00
										 |  |  |  |   <methodsynopsis> | 
					
						
							|  |  |  |  |    <type>bool</type><methodname>template_exists</methodname> | 
					
						
							|  |  |  |  |    <methodparam><type>string</type><parameter>template</parameter></methodparam> | 
					
						
							|  |  |  |  |   </methodsynopsis> | 
					
						
							|  |  |  |  |   <para> | 
					
						
							| 
									
										
										
										
											2005-12-05 21:15:38 +00:00
										 |  |  |  |    Elle accepte soit un chemin vers le template, soit une ressource de type | 
					
						
							| 
									
										
										
										
											2004-12-26 17:02:12 +00:00
										 |  |  |  |    cha<68>ne de caract<63>res sp<73>cifiant le nom du template. | 
					
						
							|  |  |  |  |   </para> | 
					
						
							| 
									
										
										
										
											2005-12-05 21:15:38 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |   <example> | 
					
						
							|  |  |  |  |    <title>template_exists()</title> | 
					
						
							|  |  |  |  |    <para> | 
					
						
							|  |  |  |  |     Cet exemple utilise $_GET['page'] pour inclure le contenu d'un template. | 
					
						
							|  |  |  |  |     Si le template n'existe pas, une page d'erreur sera affich<63> <20> la place. | 
					
						
							|  |  |  |  |    </para> | 
					
						
							|  |  |  |  |    <para> | 
					
						
							|  |  |  |  |     Le fichier <filename>page_container.tpl</filename> | 
					
						
							|  |  |  |  |    </para> | 
					
						
							|  |  |  |  |    <programlisting role="php"> | 
					
						
							|  |  |  |  | <![CDATA[ | 
					
						
							|  |  |  |  | <html> | 
					
						
							|  |  |  |  |  <head><title>{$title}</title></head> | 
					
						
							|  |  |  |  |  <body> | 
					
						
							|  |  |  |  |   {include file='page_top.tpl'} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   {* inclure le contenu du milieu de la page *} | 
					
						
							|  |  |  |  |   {include file=$page_mid} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   {include file='page_footer.tpl'} | 
					
						
							|  |  |  |  |  </body> | 
					
						
							|  |  |  |  |  ]]> | 
					
						
							|  |  |  |  |    </programlisting> | 
					
						
							|  |  |  |  |    <para> | 
					
						
							|  |  |  |  |     et le script PHP | 
					
						
							|  |  |  |  |    </para> | 
					
						
							|  |  |  |  |    <programlisting role="php"> | 
					
						
							|  |  |  |  | <![CDATA[ | 
					
						
							|  |  |  |  | <?php | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // D<>finit le nom du fichier eg index.inc.tpl | 
					
						
							|  |  |  |  | $mid_template = $_GET['page'].'.inc.tpl'; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | if( !$smarty->template_exists($mid_template) ){ | 
					
						
							|  |  |  |  |    $mid_template = 'page_not_found.inc.tpl'; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | $smarty->assign('page_mid', $mid_template); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | $smarty->display('page_container.tpl'); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | ?> | 
					
						
							|  |  |  |  | ]]> | 
					
						
							|  |  |  |  |    </programlisting> | 
					
						
							|  |  |  |  |   </example> | 
					
						
							| 
									
										
										
										
											2005-05-25 16:49:34 +00:00
										 |  |  |  |   <para> | 
					
						
							|  |  |  |  |    Voir aussi | 
					
						
							|  |  |  |  |    <link linkend="api.display">display()</link>, | 
					
						
							|  |  |  |  |    <link linkend="api.fetch">fetch()</link>, | 
					
						
							|  |  |  |  |    <link linkend="language.function.include">{include}</link> et | 
					
						
							|  |  |  |  |    <link linkend="language.function.insert">{insert}</link>. | 
					
						
							|  |  |  |  |   </para> | 
					
						
							| 
									
										
										
										
											2004-12-26 17:02:12 +00:00
										 |  |  |  |  </refsect1> | 
					
						
							|  |  |  |  | </refentry> | 
					
						
							| 
									
										
										
										
											2005-12-05 21:15:38 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-04-13 11:47:32 +00:00
										 |  |  |  | <!-- Keep this comment at the end of the file
 | 
					
						
							|  |  |  |  | Local variables: | 
					
						
							|  |  |  |  | mode: sgml | 
					
						
							|  |  |  |  | sgml-omittag:t | 
					
						
							|  |  |  |  | sgml-shorttag:t | 
					
						
							|  |  |  |  | sgml-minimize-attributes:nil | 
					
						
							|  |  |  |  | sgml-always-quote-attributes:t | 
					
						
							|  |  |  |  | sgml-indent-step:1 | 
					
						
							|  |  |  |  | sgml-indent-data:t | 
					
						
							|  |  |  |  | indent-tabs-mode:nil | 
					
						
							|  |  |  |  | sgml-parent-document:nil | 
					
						
							|  |  |  |  | sgml-default-dtd-file:"../../../../manual.ced" | 
					
						
							|  |  |  |  | sgml-exposed-tags:nil | 
					
						
							|  |  |  |  | sgml-local-catalogs:nil | 
					
						
							|  |  |  |  | sgml-local-ecat-files:nil | 
					
						
							|  |  |  |  | End: | 
					
						
							|  |  |  |  | vim600: syn=xml fen fdm=syntax fdl=2 si | 
					
						
							|  |  |  |  | vim: et tw=78 syn=sgml | 
					
						
							|  |  |  |  | vi: ts=1 sw=1 | 
					
						
							| 
									
										
										
										
											2005-12-05 21:15:38 +00:00
										 |  |  |  | --> |