{{ cookie_consent }} <section> <div> <h2>{{ title }}</h2> <p>{{ message }}</p> {{ policy_link }}Cookie policy{{ /policy_link }} <div> {{ reject }}Reject optional{{ /reject }} {{ manage }}Manage choices{{ /manage }} {{ accept }}Accept all{{ /accept }} </div> {{ preferences }} <h3>Cookie settings</h3> {{ categories }} <label> {{ input }} <span> <strong>{{ label }}</strong> <span>{{ description }}</span> </span> </label> {{ /categories }} <div> {{ close }}Close{{ /close }} {{ save }}Save choices{{ /save }} </div> {{ /preferences }} </div> </section>{{ /cookie_consent }}The first HTML element inside {{ cookie_consent }} becomes the consent root in compiled PHP. In the example, that is <section>.
Add Your Own Classes#
Classes are optional. Add them only for your theme styling:
{{ cookie_consent }} <section class="fixed bottom-0 left-0 right-0 bg-white"> <div class="mx-auto max-w-xl p-6"> <h2>{{ title }}</h2> <p>{{ message }}</p> <div>{{ reject }}Reject{{ /reject }} {{ accept }}Accept{{ /accept }}</div> </div> </section>{{ /cookie_consent }}TemplateX adds internal behavior hooks only in compiled PHP. You do not write them in the source partial.
Consent Tags#
| Tag | Output |
|---|---|
{{ title }} | The configured popup title. |
{{ message }} | The configured popup message. |
{{ policy_link }}...{{ /policy_link }} | A policy link when policy_url is configured. |
{{ accept }}...{{ /accept }} | Button that accepts all categories. |
{{ reject }}...{{ /reject }} | Button that rejects optional categories. |
{{ manage }}...{{ /manage }} | Button that opens category choices. |
{{ preferences }}...{{ /preferences }} | Hidden settings panel. |
{{ categories }}...{{ /categories }} | Loops through necessary and optional categories. |
{{ input }} | Checkbox for the current category. |
{{ label }} | Current category label. |
{{ description }} | Current category description. |
{{ close }}...{{ /close }} | Button that closes the settings panel. |
{{ save }}...{{ /save }} | Button that saves selected categories. |