Templating
Content below is copied from the official Neto B@SE docs so you can edit and annotate it locally. Original: Templating.
load_template
Loads an HTML template.
Example
Loads a template file with the Neto by Maropost template parser.
Parameters
| Name | Options | Description |
|---|---|---|
file:'' | File path relative to the selected theme folder | e.g. loading the sidebar: cms/includes/template-name.template.html |
ifempty:'', *ifempty | HTML & b@se tags | Renders this block when no template is found |
load_ajax_template
Loads a webstore template inside another template using AJAX—either to defer loading or to refresh content without a full page reload. AJAX-loaded templates are not cached the same way as other content; they should only contain the dynamic part you want to update. Avoid putting large static blocks in an AJAX template; those are better cached normally.
Example
[%load_ajax_template id:'_header' type:'item' template:'header' preload:'1' tmpl_sku:'[@current_sku@]' tmpl_preview:'y'/%]Usage
Two parts: (1) A B@SE function tag that defines what is loaded and where it goes, and (2) a JS function that triggers the AJAX refresh and reloads the template with new data.
Add the loader: Put [%load_ajax_template%] in the template where the AJAX content should appear. Convention is to give it an id that starts with an underscore, e.g. id:'_header'.
Reload the template: Call $.load_ajax_template() from a JS script or event handler when the user does something (e.g. “Load more”). Pass the same id and any extra params the template needs.
JavaScript: $.load_ajax_template() parameters
| Name | Options | Description |
|---|---|---|
| AJAX Template ID | String (required) | Unique id for the AJAX template—must match the id param in [%load_ajax_template%]. e.g. $.load_ajax_template('_header'); |
| Additional Options | JS Object (optional) | Data the template needs. Keys become B@SE tags in the AJAX template, e.g. { sku: 'INV001', content_id: 42 } → [@sku@], [@content_id@]. Use showloading: '1' for a loading overlay. B@SE cannot parse JS arrays or complex objects. |
| Callback Function | JS Function (optional) | Runs after the AJAX template has loaded. If you use a callback but no extra options, pass an empty object {} as the second argument. |
B@SE function parameters
| Name | Options | Description |
|---|---|---|
id:'' | String | Unique ID of the AJAX template; used by $.load_ajax_template() to find this block |
type:'' | cart, item, content | Type of content to load; some params only apply to certain types |
template:'' | Template filename without .template.html | HTML file to load, in the includes folder for that type: cart/includes/, products/includes/, cms/includes/ |
preload:'' | 1 / 0 | 1: render with initial page load (then AJAX can reload later). 0: hide until an action triggers a reload |
tmpl_sku:'' | Product SKU | For type:'item'; which product is in scope |
tmpl_preview:'' | y / n | y: call with ?preview=y so unapproved products or preview URLs work |
tmpl_x:'' | String or B@SE tag | Pass a value into the AJAX template; x is the B@SE tag name. e.g. tmpl_custom:'yes' → [@custom@] is “yes”. Persists on refresh unless overridden when calling $.load_ajax_template(). |
Your annotations
Use this section to note anything that’s incorrect in the official docs or extended by your implementation.