1.x.x | viewUri | | Code Block |
---|
ctx.builder.a('href', ctx.viewUri, 'link') |
| Retrieves current URL |
1.x.x | builder | | Code Block |
---|
ctx.builder.html {
body {
div('Some text');
}
} |
| Markup builder |
1.x.x | include | relativePath | Code Block |
---|
ctx.builder.section('class': 'blog') {
div('class': 'container') {
div('class': 'row') {
ctx.include('component/' + (centralView ?: 'EmptyCentralView') + '.groovy');
}
}
} |
| Include a script file in current template execution scope |
1.x.x | includeurl | relativePath | Code Block |
---|
ctx.includeurl '/internal/breadcrumbs';
ctx.builder.section('class': 'blog') {
div('class': 'container') {
div('class': 'row') {
ctx.includeurl "/internal/categorybody?categoryId=${sf.categoryId}";
}
}
} |
| Invoke a sub request result of which will be amalgamated in final response |
3.5.x | includevariant | relativePath, defaultPath | Code Block |
---|
ctx.includevariant(_optTemplate + '.groovy', 'SkuOptionsDim.groovy'); |
| Include a script variation (if one exists) or default otherwise in current template execution scope |
1.x.x | pagecache | timeout, keyType | Code Block |
---|
ctx.pagecache('1d', '-'); |
| Meta data to instruct page template caching. timeout: - d (days),
- h (hours),
- m (minutes),
- s (seconds)
keyType: - '-' - all users
- 'user' - user specific cache
|
1.x.x | inlineResource | relativePath | Code Block |
---|
div('class': 'col-xs-12 col-md-4') {
mkp.yieldUnescaped( ctx.inlineResource('StandardFooterNavIncludeSocial.html') );
}
|
| Inline file in the generated markup |
1.x.x | content | contentId | Code Block |
---|
div('class': 'form-group') {
mkp.yieldUnescaped(ctx.content('reset_resetform_content_include'));
}
|
| Retrieve content from CMS as a string by SEO URI |
1.x.x | contentExists | contentId | Code Block |
---|
if (ctx.contentExists(_optCms)) { // shop specific rendering
mkp.yieldUnescaped(ctx.dynamicContent(_optCms, [
'product': product,
'skus': _skus,
'sku': _sku,
'fc': _fc,
'optionsModel': _optionsModel,
'optionsModelItem': _option
]));
} |
| Check if content is defined in CMS |
1.x.x | dynamicContent | contentId, parameters | Code Block |
---|
if (ctx.contentExists(_optCms)) { // shop specific rendering
mkp.yieldUnescaped(ctx.dynamicContent(_optCms, [
'product': product,
'skus': _skus,
'sku': _sku,
'fc': _fc,
'optionsModel': _optionsModel,
'optionsModelItem': _option
]));
} |
| Retrieve content from CMS as a string by SEO URI. Content is preprocessed by template engine. |
1.x.x | msg | messageKey | Code Block |
---|
span(ctx.msg('addToCompare')); |
| Retrieves message from shop.properties.xml |
1.x.x | msgf | messageKey, parameters | Code Block |
---|
a('href': ctx.URL('logout'), 'rel': 'nofollow', 'title': ctx.msgf('logoffTitle', ['customer': sf?.managerName])) {
span ctx.msg('logoffLabel');
} |
| Retrieves message from shop.properties.xml. Message is preprocessed by template engine. |
1.x.x | contentURL | contentId | Code Block |
---|
a('href': ctx.contentURL('license'), 'rel': 'bookmark') {
span(ctx.msg('licenceInfo'));
} |
| Generate content page relative URL |
1.x.x | categoryURL | categoryId | Code Block |
---|
a('rel': 'bookmark', 'href': ctx.categoryURL('notebooks')) {
img('src': ctx.resourceURL('image/baner1.png'));
} |
| Generate category page relative URL |
1.x.x | productURL | productId, fc | Code Block |
---|
def _url = ctx.productURL(_item.product.uri, _item.supplierCode); |
| Generate product page relative URL for specific fulfilment centre |
1.x.x | skuURL | productId, fc | Code Block |
---|
a('rel': 'bookmark', 'href': ctx.skuURL(_item.productSku.uri, _item.supplierCode)) {
span(ctx.macroProductName.name(_item.productSku));
} |
| Generate SKU page relative URL for specific fulfilment centre |
1.x.x | resourceURL | path | Code Block |
---|
a('rel': 'bookmark', 'href': ctx.categoryURL('notebooks')) {
img('src': ctx.resourceURL('image/baner1.png'));
} |
| Generate resource relative URL |
1.x.x | filteredURL | path | Code Block |
---|
def _selected = _multi && ctx.macroFormUtils.values(_filteredNavBlock.code).contains(_filteredNavBlockValue.value);
def _path = _filteredNavBlock.code + '/' + ctx.encodeURI(_filteredNavBlockValue.value);
def _href;
if (_selected) {
_href = ctx.filteredURL('').replace(_path, '').replace('//', '/');
} else {
_href = ctx.filteredURL(_path);
} |
| Generate relative URL including filter navigation parameters |
1.x.x | URL | path | Code Block |
---|
a('href': ctx.URL('management/customers'), 'rel': 'nofollow') {
span ctx.msg('managedCustomers');
} |
| Generate relative URL |
4.1.x | toAbsoluteURL | url, scheme | Code Block |
---|
a('href': ctx.toAbsoluteURL(ctx.URL('management/customers'), 'https'), 'rel': 'nofollow') {
span ctx.msg('managedCustomers');
} |
| Convert relative URL to absolute one |
1.x.x | encodeURI | uri | Code Block |
---|
input('type': 'hidden', 'name': 'returnTo', 'value': ctx.encodeURI('checkout?step=address')); |
| Encode value |
1.x.x | decodeURI | uri | Code Block |
---|
a('href': ctx.URL(ctx.decodeURI(ctx.macroFormUtils.value('returnTo', 'profile'))), 'class': 'btn btn-default', 'title': ctx.msg('cancel')) {
mkp.yieldUnescaped(ctx.msg('cancel'));
} |
| Decode value |