Variable example

Variable example

variable {$variable}

Variable assignment

assignment {$number=10} and print {$number}

Variable Modifiers

{$variable|strlen}
{$variable|substr:0,7}


Global variables

The variable is declared as global into the PHP {$GLOBALS.global_variable}

Show all declared variables

To show all declared variable use.

{$this->var|print_r}

Constants

Constant

Constant: {#true#}

Modier on constant as follow

{#PHP_VERSION|strlen|round|count}

Loop example

Simple loop example

    {loop="$week"}
  • {$key} = {$value}
  • {/loop}


Loop example with associative array

  • ID _ Name _ Color
  • {loop="$user"}
  • {$key}) - {$value.name|strtoupper} - {$value.color}
  • {/loop}


Loop an empty array

    {loop="$empty_array"}
  • {$key}) - {$value.name} - {$value.color}
  • {else} The array is empty {/loop}

If Example

simple if example

{if="$number==10"}OK! {else}NO!{/if}

example of if, elseif, else example

{if="substr($variable,0,1)=='A'"}First character is A {elseif="substr($variable,0,1)=='B'"}First character is B {else}First character of variable is not A neither B {/if}

Custom function

{@message@}

Path Replace (WYSIWYG)

WYSIWYG

RainTPL replaces relative paths of images, css and links automatically with the correct server paths.

Path replace on relative path of image

into the template the image is wrote as: <img src="img/logo.gif" alt="logo"/> in the compiled template the path is replaced with the correct path tpl/img/logo.gif:
logo


Absolute paths and path ending with # are not replaced

For more info read the documentation: http://www.raintpl.com/Documentation/Documentation-for-web-designers/WYSIWYG/