Tangra_Simple_Tple __construct(
[string
$tpl_path = NULL], [string
$ld = '{@'], [string
$rd = '@}']
)
|
|
Sets template paths and throws exception if the path is not existing.
Parameters:
|
string |
$tpl_path: |
path to template directory |
|
string |
$ld: |
left delimiter for tags. Default is {@ |
|
string |
$rd: |
right delimiter for tags. Default is @} |
Information Tags:
void assign(
string
$tpl_var, [string
$value = null]
)
|
|
Assignes value to a key/tag.
Will throw exception if $tpl_var does not conform ereg("[a-zA-Z0-9_]+"), i.e. is not alphanumeric (with optional underscore)
Parameters:
|
string |
$tpl_var: |
|
|
string |
$value: |
|
API Tags:
Information Tags:
Implementation of:
- I_Tple::assign()
- Assignes value to variable in tple dataspace
void assign_set_array(
unknown_type
$vars_array
)
|
|
Sets entire assigment array at once. Useful when array is loaded from file. Normally is not used by the users.
Throws exception if parameter is not an array.
Parameters:
|
unknown_type |
$vars_array: |
|
API Tags:
Information Tags:
void assign_strict(
string
$tpl_var, any
$value
)
|
|
Assignes value to a key/tag. Similar to Tangra_Simple_Tple::assign() but will throw exception if there is already added value with the same key.
Will throw exception if $tpl_var does not conform ereg("[a-zA-Z0-9_]+"), i.e. is not alphanumeric (with optional underscore)
Parameters:
|
string |
$tpl_var: |
key/tag name |
|
any |
$value: |
|
API Tags:
Information Tags:
| Throws: | TE_Var_Already_Exists |
boolean check_tpl_var_name(
string
$tpl_var
)
|
|
Checks if $tpl_var is "valid" key identifier
Parameters:
API Tags:
void clear_all_assigns(
)
|
|
Clears all asigments.
API Tags:
void display(
string
$tpl
)
|
|
Parses and displays template file.
Parameters:
|
string |
$tpl: |
file to be showed |
API Tags:
Implementation of:
- I_Tple::display()
- Displays the template
string fetch(
string
$tpl
)
|
|
Loads file specified by $tpl, parses it and returns it with all tags replaced with assigned values.
Parameters:
API Tags:
Implementation of:
- I_Tple::fetch()
- Fetches and returns the template
void get_left_delimiter(
string
$left_delimiter
)
|
|
Gets left delimiter for the tags in the template
Parameters:
API Tags:
unknown get_right_delimiter(
)
|
|
Gets right delimiter for the tags in the template
API Tags:
Gets template path
API Tags:
void set_left_delimiter(
[string
$left_delimiter = '{@$']
)
|
|
Sets left delimiter for the tags in the template
Parameters:
API Tags:
unknown set_right_delimiter(
[
$right_delimiter = '@}']
)
|
|
Sets right delimiter for the tags in the template
Parameters:
API Tags:
void set_tpl_path(
string
$tpl_path
)
|
|
Sets template dir that will be used to compose the full path for the template file
Parameters:
API Tags:
string _fetch(
string
$content, [boolean
$strip_unused_tags = true]
)
|
|
Parses $content and returns it with all tags replaced with assigned values.
Parameters:
|
string |
$content: |
content to be parsed |
|
boolean |
$strip_unused_tags: |
if true will strip tags that are not replaced (this happens when there are tags in the $content but no values are provided for them with assign()) |
API Tags:
| Return: | parsed content |
| Access: | public |