Author: Raymond Bosman Date: 2007-04-11 13:17:33 +0200 (Wed, 11 Apr 2007) New Revision: 4850
Log: - Documented the Location Object. Modified: trunk/Template/docs/syntax.txt Modified: trunk/Template/docs/syntax.txt =================================================================== --- trunk/Template/docs/syntax.txt 2007-04-11 09:51:46 UTC (rev 4849) +++ trunk/Template/docs/syntax.txt 2007-04-11 11:17:33 UTC (rev 4850) @@ -141,7 +141,39 @@ Answer: 5 +Template locations +------------------ +Since version 1.2 it is possible to send a Location object instead of a +*location* parameter of the *process* method. A Location object is an object +that implements the Location interface. The interface is as follows:: + interface ezcTemplateLocationInterface + { + public function getPath(); + } + +The template engine calls the *getPath* method on the object implementing this +interface when needed. The *getPath* method returns a +string specifying the template to execute. If the return value is a relative +path , if it does not start with a slash, then the *templatePath* from the +configuration is prepended. + +The next example executes the *hello\_world.ezt* template via a location +object:: + + class MyLocation implements ezcTemplateLocationInterface + { + public function getPath() + { + return "hello_world.ezt"; + } + } + + $t = new ezcTemplate(); + $t->process( new MyLocation() ); + + + Template syntax =============== This section explains the syntax that can be used in the template itself. @@ -709,7 +741,7 @@ - Functions_ The operands Boolean, Integer, Float, String, and Array are described in the -Types_ section. Variables are described in the Variables_ section. Functions +`Primitive types`_ section. Variables are described in the Variables_ section. Functions will be described in the Functions_ section. Variables and functions are considered as operands since they return one @@ -1405,10 +1437,14 @@ The syntax of the include is as follows:: - {include <template_name> + {include <template_name | location_object > [ send <send_variables> ] [ receive <receive_variables> ] +The file that needs to be included is either specified with a string +(template\_name) or with a location object. The location object is explained in +the section `Template locations`_. + The <send\_variables> has this syntax:: <expression> as <variable> | <variable> @@ -1604,7 +1640,7 @@ :optionalParameters: Optional named parameters for this custom block. :requiredParameters: Required named parameters for this custom block. :isStatic: The custom block is only called during compilation. At run time the -static output from the custom block at compile time is displayed. + static output from the custom block at compile time is displayed. The following custom block creates a hyper-link from a name and an URL:: -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components