| 
									
										
										
										
											2004-04-13 08:46:28 +00:00
										 |  |  | <?xml version="1.0" encoding="iso-8859-1"?> | 
					
						
							|  |  |  | <!-- $Revision$ --> | 
					
						
							| 
									
										
										
										
											2005-05-10 20:54:42 +00:00
										 |  |  | <sect1 id="language.function.php"> | 
					
						
							| 
									
										
										
										
											2005-05-25 19:13:20 +00:00
										 |  |  |  <title>{php}</title> | 
					
						
							| 
									
										
										
										
											2005-05-10 20:54:42 +00:00
										 |  |  |  <para> | 
					
						
							| 
									
										
										
										
											2005-05-24 14:01:49 +00:00
										 |  |  |   {php} tags allow php to be embedded directly into the template. They | 
					
						
							| 
									
										
										
										
											2005-05-10 20:54:42 +00:00
										 |  |  |   will not be escaped, regardless of the <link | 
					
						
							|  |  |  |   linkend="variable.php.handling">$php_handling</link> setting. This | 
					
						
							|  |  |  |   is for advanced users only, not normally needed. | 
					
						
							|  |  |  |  </para> | 
					
						
							|  |  |  |  <example> | 
					
						
							| 
									
										
										
										
											2005-05-27 16:25:02 +00:00
										 |  |  |   <title>{php} tags</title> | 
					
						
							|  |  |  |   <programlisting role="php"> | 
					
						
							| 
									
										
										
										
											2005-05-10 20:54:42 +00:00
										 |  |  | <![CDATA[ | 
					
						
							| 
									
										
										
										
											2005-05-27 16:25:02 +00:00
										 |  |  | {php} | 
					
						
							| 
									
										
										
										
											2005-05-10 20:54:42 +00:00
										 |  |  |    // including a php script directly | 
					
						
							|  |  |  |    // from the template. | 
					
						
							| 
									
										
										
										
											2005-09-13 18:41:44 +00:00
										 |  |  |    include('/path/to/display_weather.php'); | 
					
						
							| 
									
										
										
										
											2005-05-27 16:25:02 +00:00
										 |  |  | {/php} | 
					
						
							| 
									
										
										
										
											2005-05-10 20:54:42 +00:00
										 |  |  | ]]> | 
					
						
							|  |  |  |   </programlisting> | 
					
						
							|  |  |  |  </example> | 
					
						
							| 
									
										
										
										
											2005-05-27 16:25:02 +00:00
										 |  |  | <note> | 
					
						
							|  |  |  | <title>Technical Note</title> | 
					
						
							|  |  |  | <para> | 
					
						
							|  |  |  |    To access PHP variables in {php} blocks you may need to use the PHP | 
					
						
							|  |  |  |    <ulink url="&url.php-manual;global">global</ulink> | 
					
						
							|  |  |  |    keyword. | 
					
						
							|  |  |  | </para> | 
					
						
							|  |  |  | </note> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-13 18:41:44 +00:00
										 |  |  |  <example> | 
					
						
							|  |  |  |   <title>{php} tags with global</title> | 
					
						
							|  |  |  |   <programlisting role="php"> | 
					
						
							|  |  |  | <![CDATA[ | 
					
						
							|  |  |  | {php} | 
					
						
							|  |  |  |    global $foo, $bar; | 
					
						
							|  |  |  |    if($foo == $bar){ | 
					
						
							|  |  |  |      // do something | 
					
						
							|  |  |  |    } | 
					
						
							|  |  |  | {/php} | 
					
						
							|  |  |  | ]]> | 
					
						
							|  |  |  |   </programlisting> | 
					
						
							|  |  |  |  </example> | 
					
						
							|  |  |  |   | 
					
						
							| 
									
										
										
										
											2005-05-10 20:54:42 +00:00
										 |  |  |  <para> | 
					
						
							|  |  |  |   See also | 
					
						
							| 
									
										
										
										
											2005-05-24 14:01:49 +00:00
										 |  |  |   <link linkend="variable.php.handling">$php_handling</link>, | 
					
						
							| 
									
										
										
										
											2005-05-10 20:54:42 +00:00
										 |  |  |   <link linkend="language.function.include.php">{include_php}</link>, | 
					
						
							| 
									
										
										
										
											2005-05-27 16:25:02 +00:00
										 |  |  |   <link linkend="language.function.include">{include}</link> and | 
					
						
							| 
									
										
										
										
											2005-05-10 20:54:42 +00:00
										 |  |  |   <link linkend="tips.componentized.templates">Componentized Templates</link>. | 
					
						
							|  |  |  |  </para> | 
					
						
							| 
									
										
										
										
											2004-04-13 08:46:28 +00:00
										 |  |  | </sect1> | 
					
						
							|  |  |  | <!-- 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 | 
					
						
							|  |  |  | --> |