PHP Classes

File: docs/Features/Dialect translator.md

Recommend this page to a friend!
  Packages of Rafa Rodriguez   Div PHP Template Engine   docs/Features/Dialect translator.md   Download  
File: docs/Features/Dialect translator.md
Role: Example script
Content type: text/markdown
Description: Example script
Class: Div PHP Template Engine
Template processing engine that replaces tags
Author: By
Last change:
Date: 4 months ago
Size: 631 bytes
 

Contents

Class file image Download

Div provide a translator for dialects. This translator can translate from any dialect to current dialect. Div use the current template's variables for self help in the translation. For this reason, you only translate having a instance of div.

Example

index.php

<?php
	
include 'div.php';
	
$tpl = new div('index.tpl');
	
$tpl->translateFrom([
	'DIV_TAG_IGNORE_BEGIN' => '{literal}',
	'DIV_TAG_IGNORE_END' => '{/literal}'
]);
	
$tpl->show();

index.tpl


{= name: "Peter" =}
	
{literal}
	{$name}
{/literal}
	
{$name}

index.tpl (translated)

	
{= name: "Peter" =}
	
{ignore}
	{$name}
{/ignore}
	
{$name}