-
Notifications
You must be signed in to change notification settings - Fork 0
Placeholders
Suppenhuhn79 edited this page May 17, 2021
·
2 revisions
Text and non-ps attributes within a snippet may contain placeholders. These will be replaced by values on production.
Placeholders are enclosed in double curly brackets (e.g. {{my-value}}
).
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <ps:pagesnippets xmlns:ps="https://github.com/suppenhuhn79/pagesnippets"> <ps:snippet name="customer"> <div class="customer" data-cusnumber="{{customer.number}}"> <div>{{customer.name.salutation}} {{customer.name.last-name}}</div> </div> </ps:snippet> </ps:pagesnippets>var data = { "customer": { "number": 12345, "name": { "salutation": "Mr.", "first-name": "Bob", "last-name": "Miller" } } }; document.body.appendChild(pageSnippets.customer.produce(this, data));<div class="customer" data-cusnumber="12345"> <div>Mr. Miller</div> </div>
The prefix ps:
used in XML code is the recommended tag prefix for elements of the pageSnippet-namespace:
<ps:pagesnippets xmlns:ps="https://github.com/suppenhuhn79/pagesnippets">