PHP Classes

File: docs/Features/Locations.md

Recommend this page to a friend!
  Packages of Rafa Rodriguez   Div PHP Template Engine   docs/Features/Locations.md   Download  
File: docs/Features/Locations.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: Div PHP Template Engine
Template processing engine that replaces tags
Author: By
Last change:
Date: 3 months ago
Size: 1,308 bytes
 

Contents

Class file image Download

The locations are tags that identify some positions into template. With this feature you can define a location in any part of the template, and then collocate any content in this location. The tag that represent the location can be repeated in other positions. Also, you can locate several template pieces in the same location.

Now you can separate two concepts: the content from their location in the template. This advantage can be resolved with [[Simple replacements]] of  [[Template's variables]] but this is not sufficient and it is not equal.

Syntax

Define the location:
	
(( location_name ))
	
Define the content:
	
{{location_name
	
... some content here ...
	
location_name}}

Example

layout.tpl

<html>
	<body>
		<div id="header">(( header ))</div>
		<div id="content">(( content ))</div>
		<div id="footer">(( footer ))</div>
	</body> 
</html>

index.tpl

{% layout %}
	
{{header
	This is the header
header}}
	
{{footer
	This is the footer
footer}}
	
{{content
	This is the content
content}}
	
{{header
	<br/>.... more in the header .....
header}}

Output

<html>
	<body>
		<div id="header">This is the header<br/>.... more in the header .....</div>
		<div id="content">This is the content</div>
		<div id="footer">This is the footer</div>
	</body> 
</html>