How to use OXID functions in tpl files?

There is a list of oxid functions:
http://docu.oxid-esales.com/CE/sourcecodedocumentation/4.0.0.0.13895/

how to call them through smarty tags? Or they are available only when writing modules?

Also I can not find a list of all variables and arrays and functions, that is used in .tpl files.

For example:
[{if $rsslinks}] —???
[{foreach from=$rsslinks item=‘rssentry’}]
<link rel=“alternate” type=“application/rss+xml” title="[{$rssentry.title|strip_tags}]" href="[{$rssentry.link}]">
[{/foreach}]
[{/if}]

[{ $oView->getViewId() }] -???
[{ $oViewConf->getSelfLink() }] -???

[{if $oView->showTopBasket()}] -???
[{oxid_include_dynamic file=“dyn/top_basket.tpl” type=“basket”}]
[{/if}]

Where is a description of them all???
Or I have to guess how it works???

And there is more interesting that I can not use these variables through a simple php code.
[{php}]
print_r(‘Hello world’); //returns ‘Hello world’.
print_r($rsslinks); //returns nothing.
[{/php}]

[{$rsslinks}] // returns “Array”

And also I can not understand: why they use ‘smarty’?
Simple PHP is much more easier.
If you see drupal templates of a some theme (.tpl.php), there is no template engine used, and it works great and it is easy to change them.

Objects:
[{$oObject->method(‘param1’,‘param2’)}]

No chaining possible.
$oObject->getSubObject()->getValue()

No statics.
oClass::getInstance()

This is the reason why there so much [{assign …}] in oxid templates.

Smarty-Plugins (modifier):
[{‘value’|smartyPlugin}]
[{‘value1’|smartyPlugin:‘value2’}]

Smarty-Plugins (function):
[{smartyPlugin}]
eg:
[B][{debug}][/B] -->shows all current smarty-variables in a popup

PHP-Functions:
like Plugins with leading @ in function name. You need everytime a parameter.
[{‘param1’|@phpFunction}]

Eg:
[{$rsslinks|@print_r}]

or (i think it was)
[{php}]
print_r($this->_tpl_vars->rsslinks);
[{/php}]
… maybe $smarty instead of $this?

Chaining of functons in smarty:
[{‘value’|@function1|@function2}]
php:
function2(function1(‘value’))… i think
I never can see what will happen - everytime try and error - and brackets (…) dont work (well).

Arrays:
sometimes you can use
[{$aArray[vector]}]
sometimes this
[{$aArray.vector}]

Yes, smarty is a %$/$%.
Why they use something like a own lexer/parser, if the original language works and is well documentated?

The only nice things are:

  • caching and manipulating pre-compiled templates… i guess every template engine can do it.
  • iterators (foreach) -> i can do it self… if i need.

Edit: http://nosmarty.net/ a lot of more examples.

There were some efforts to remove smarty: https://projects.oxidforge.org/projects/killsmarty

And your first question: I’m afraid there is no description of all the functions, but you can look in view sourcecode. There are some Variables that are always passed to smarty (by oxview::addGlobalParams) including $oView (current view class) and $oViewConf (some additional data).

You can look for the methods of $oView in the view class itself (e.g. details.php), or its parents oxview and oxubase. The methods of $oViewConf are in class oxviewconfig.

You can use the methods you find there in smarty, or extend the view class to place your own methods there.