Converted plugins and syntax pieces
Here is list of plugins and syntax pieces with basic examples how it is converted. Note that these examples are only to show how it is converted and doesn’t cover all possible cases as additional parameters, block nesting, repetitive calls (as for counter and cycle functions) etc.
Core Smarty
assign => set
Converter name: assign
[{assign var="name" value="Bob"}]
{% set name = "Bob" %}
block => block
Converter name: block
[{block name="title"}]Default Title[{/block}]
{% block title %}Default Title{% endblock %}
capture => set
Converter name: CaptureConverter
[{capture name="foo" append="var"}] bar [{/capture}]
{% set foo %}{{ var }} bar {% endset %}
counter => set
Converter name: counter
[{counter}]
{% set defaultCounter = ( defaultCounter | default(0) ) + 1 %}
cycle => smarty_cycle
Converter name: cycle
[{cycle values="val1,val2,val3"}]
{{ smarty_cycle(["val1", "val2", "val3"]) }}
foreach => for
Converter name: for
[{foreach $myColors as $color}]foo[{/foreach}]
{% for color in myColors %}foo{% endfor %}
if => if
Converter name: if
[{if !$foo or $foo->bar or $foo|bar:foo["hello"]}]foo[{/if}]
{% if not foo or foo.bar or foo|bar(foo["hello"]) %}foo{% endif %}
include => include
Converter name: include
[{include file='page_header.tpl'}]
{% include 'page_header.tpl' %}
insert => include
Converter name: insert
[{insert name="oxid_tracker" title="PRODUCT_DETAILS"|oxmultilangassign product=$oDetailsProduct cpath=$oView->getCatTreePath()}]
{% include "oxid_tracker" with {title: "PRODUCT_DETAILS"|oxmultilangassign, product: oDetailsProduct, cpath: oView.getCatTreePath()} %}
mailto => mailto
Converter name: mailto
[{mailto address='me@example.com'}]
{{ mailto('me@example.com') }}
math => core Twig math syntax
Converter name: math
[{math equation="x + y" x=1 y=2}]
{{ 1 + 2 }}
Variable conversion
Converter name: variable
Smarty |
Twig |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Other
Converter name: misc
Smarty |
Twig |
|
|
|
|
|
|
OXID custom extensions
oxcontent => include content
Converter name: oxcontent
[{oxcontent ident='oxregisteremail'}]
{% include 'content::ident::oxregisteremail' %}
oxeval => include(template_from_string())
Converter name: OxevalConverter
[{oxeval var=$variable}]
{{ include(template_from_string(variable)) }}
oxgetseourl => seo_url
Converter name: oxgetseourl
[{oxgetseourl ident=$oViewConf->getSelfLink()|cat:"cl=basket"}]
{{ seo_url({ ident: oViewConf.getSelfLink()|cat("cl=basket") }) }}
oxhasrights => hasrights
Converter name: oxhasrights
[{oxhasrights object=$edit readonly=$readonly}]foo[{/oxhasrights}]
{% hasrights { "object": "edit", "readonly": "readonly", } %}foo{% endhasrights %}
oxid_include_dynamic => include_dynamic
Converter name: oxid_include_dynamic
[{oxid_include_dynamic file="form/formparams.tpl"}]
{% include_dynamic "form/formparams.tpl" %}
oxid_include_widget => include_widget
Converter name: oxid_include_widget
[{oxid_include_widget cl="oxwCategoryTree" cnid=$oView->getCategoryId() deepLevel=0 noscript=1 nocookie=1}]
{{ include_widget({ cl: "oxwCategoryTree", cnid: oView.getCategoryId(), deepLevel: 0, noscript: 1, nocookie: 1 }) }}
oxifcontent => ifcontent
Converter name: oxifcontent
[{oxifcontent ident="TOBASKET" object="aObject"}]foo[{/oxifcontent}]
{% ifcontent ident "TOBASKET" set aObject %}foo{% endifcontent %}
oxinputhelp => include “inputhelp.tpl”
Converter name: oxinputhelp
[{oxinputhelp ident="foo"}]
{% include "inputhelp.tpl" with {'sHelpId': getSHelpId(foo), 'sHelpText': getSHelpText(foo)} %}
oxmailto => oxmailto
Converter name: oxmailto
[{oxmailto address='me@example.com'}]
{{ mailto('me@example.com') }}
oxmultilang => translate
Converter name: oxmultilang
[{oxmultilang ident="ERROR_404"}]
{{ translate({ ident: "ERROR_404" }) }}
oxprice => format_price
Converter name: oxprice
[{oxprice price=$basketitem->getUnitPrice() currency=$currency}]
{{ format_price(basketitem.getUnitPrice(), { currency: currency }) }}
oxscript => script
Converter name: oxscript
[{oxscript include="js/pages/details.min.js" priority=10}]
{{ script({ include: "js/pages/details.min.js", priority: 10, dynamic: __oxid_include_dynamic }) }}
oxstyle => style
Converter name: oxstyle
[{oxstyle include="css/libs/chosen/chosen.min.css"}]
{{ style({ include: "css/libs/chosen/chosen.min.css" }) }}
section => for
Converter name: section
[{section name=picRow start=1 loop=10}]foo[{/section}]
{% for picRow in 1..10 %}foo{% endfor %}
Filters
Smarty |
Twig |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Comments
Converter name:
comment
[{* foo *}]
{# foo #}