| 
									
										
										
										
											2004-10-07 18:50:52 +00:00
										 |  |  |  | <?xml version="1.0" encoding="iso-8859-1"?> | 
					
						
							|  |  |  |  | <!-- $Revision$ --> | 
					
						
							|  |  |  |  | <refentry id="api.display"> | 
					
						
							|  |  |  |  |  <refnamediv> | 
					
						
							| 
									
										
										
										
											2005-11-08 23:37:29 +00:00
										 |  |  |  |   <refname>display()</refname> | 
					
						
							|  |  |  |  |   <refpurpose>Despliega el Template</refpurpose> | 
					
						
							| 
									
										
										
										
											2004-10-07 18:50:52 +00:00
										 |  |  |  |  </refnamediv> | 
					
						
							|  |  |  |  |  <refsect1> | 
					
						
							| 
									
										
										
										
											2005-11-08 23:37:29 +00:00
										 |  |  |  |   <title>Descripci<EFBFBD>n </title> | 
					
						
							| 
									
										
										
										
											2004-10-07 18:50:52 +00:00
										 |  |  |  |   <methodsynopsis> | 
					
						
							|  |  |  |  |    <type>void</type><methodname>display</methodname> | 
					
						
							|  |  |  |  |    <methodparam><type>string</type><parameter>template</parameter></methodparam> | 
					
						
							|  |  |  |  |    <methodparam choice="opt"><type>string</type><parameter>cache_id</parameter></methodparam> | 
					
						
							|  |  |  |  |    <methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam> | 
					
						
							|  |  |  |  |   </methodsynopsis> | 
					
						
							|  |  |  |  |   <para> | 
					
						
							| 
									
										
										
										
											2005-11-08 23:37:29 +00:00
										 |  |  |  |    Este despliega el template diferente de <link | 
					
						
							|  |  |  |  |     linkend="api.fetch">fetch()</link>. Cargando un tipo valido de path | 
					
						
							| 
									
										
										
										
											2004-10-07 18:50:52 +00:00
										 |  |  |  |    <link linkend="template.resources">template resource</link>. | 
					
						
							|  |  |  |  |    Como un segundo par<61>metro opcional, usted puede pasar un | 
					
						
							|  |  |  |  |    identificador de cache. | 
					
						
							|  |  |  |  |    Vea el <link linkend="caching">caching section</link> para mayor | 
					
						
							|  |  |  |  |    informaci<63>n. | 
					
						
							|  |  |  |  |   </para> | 
					
						
							|  |  |  |  |   ¶meter.compileid; | 
					
						
							|  |  |  |  |   <example> | 
					
						
							| 
									
										
										
										
											2005-11-08 23:37:29 +00:00
										 |  |  |  |    <title>display()</title> | 
					
						
							| 
									
										
										
										
											2004-10-07 18:50:52 +00:00
										 |  |  |  |    <programlisting role="php"> | 
					
						
							|  |  |  |  | <![CDATA[ | 
					
						
							|  |  |  |  | <?php | 
					
						
							|  |  |  |  | include("Smarty.class.php"); | 
					
						
							|  |  |  |  | $smarty = new Smarty; | 
					
						
							|  |  |  |  | $smarty->caching = true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // only do db calls if cache doesn't exist | 
					
						
							|  |  |  |  | if(!$smarty->is_cached("index.tpl")) { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   // dummy up some data | 
					
						
							|  |  |  |  |   $address = "245 N 50th"; | 
					
						
							|  |  |  |  |   $db_data = array( | 
					
						
							|  |  |  |  |                "City" => "Lincoln", | 
					
						
							|  |  |  |  |                "State" => "Nebraska", | 
					
						
							|  |  |  |  |                "Zip" => "68502" | 
					
						
							|  |  |  |  |              ); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   $smarty->assign("Name","Fred"); | 
					
						
							|  |  |  |  |   $smarty->assign("Address",$address); | 
					
						
							|  |  |  |  |   $smarty->assign($db_data); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | // display the output | 
					
						
							|  |  |  |  | $smarty->display("index.tpl"); | 
					
						
							|  |  |  |  | ?> | 
					
						
							|  |  |  |  | ]]> | 
					
						
							|  |  |  |  |    </programlisting> | 
					
						
							|  |  |  |  |   </example> | 
					
						
							|  |  |  |  |   <para> | 
					
						
							|  |  |  |  |    Use la sintaxis <link linkend="template.resources">template resources</link> | 
					
						
							| 
									
										
										
										
											2005-11-08 23:37:29 +00:00
										 |  |  |  |    para mostrar archivos fuera del directorio  | 
					
						
							|  |  |  |  |    <link linkend="variable.template.dir">$template_dir</link>. | 
					
						
							| 
									
										
										
										
											2004-10-07 18:50:52 +00:00
										 |  |  |  |   </para> | 
					
						
							|  |  |  |  |   <example> | 
					
						
							|  |  |  |  |    <title>Ejemplos de recursos de la funci<63>n display</title> | 
					
						
							|  |  |  |  |    <programlisting role="php"> | 
					
						
							|  |  |  |  | <![CDATA[ | 
					
						
							|  |  |  |  | <?php | 
					
						
							|  |  |  |  | // absolute filepath | 
					
						
							| 
									
										
										
										
											2005-11-08 23:37:29 +00:00
										 |  |  |  | $smarty->display('/usr/local/include/templates/header.tpl'); | 
					
						
							| 
									
										
										
										
											2004-10-07 18:50:52 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | // absolute filepath (same thing) | 
					
						
							| 
									
										
										
										
											2005-11-08 23:37:29 +00:00
										 |  |  |  | $smarty->display('file:/usr/local/include/templates/header.tpl'); | 
					
						
							| 
									
										
										
										
											2004-10-07 18:50:52 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | // windows absolute filepath (MUST use "file:" prefix) | 
					
						
							| 
									
										
										
										
											2005-11-08 23:37:29 +00:00
										 |  |  |  | $smarty->display('file:C:/www/pub/templates/header.tpl'); | 
					
						
							| 
									
										
										
										
											2004-10-07 18:50:52 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | // include from template resource named "db" | 
					
						
							| 
									
										
										
										
											2005-11-08 23:37:29 +00:00
										 |  |  |  | $smarty->display('db:header.tpl'); | 
					
						
							| 
									
										
										
										
											2004-10-07 18:50:52 +00:00
										 |  |  |  | ?> | 
					
						
							|  |  |  |  | ]]> | 
					
						
							|  |  |  |  |    </programlisting> | 
					
						
							|  |  |  |  |   </example> | 
					
						
							| 
									
										
										
										
											2005-11-08 23:37:29 +00:00
										 |  |  |  |     <para> | 
					
						
							|  |  |  |  |      Ver tambi<62>n <link linkend="api.fetch">fetch()</link> y | 
					
						
							|  |  |  |  |      <link linkend="api.template.exists">template_exists()</link>. | 
					
						
							|  |  |  |  |     </para> | 
					
						
							| 
									
										
										
										
											2004-10-07 18:50:52 +00:00
										 |  |  |  |  </refsect1> | 
					
						
							|  |  |  |  | </refentry> | 
					
						
							|  |  |  |  | <!-- 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 | 
					
						
							|  |  |  |  | --> |