Shared values like email and phone number
This is an open discussion with 3 replies, filed under XSLT.
Search
You could define these as variables in your master.xsl
:
<xsl:variable name="email" value="'user@domain.com'" />
If they aren’t going to change often, there doesn’t seem to be much value in adding them into a Symphony section I don’t think.
Or, create your section as described, and attach a Data Source to every page. In XSLT you could create a key
in your master template (so it becomes globally accessible by all other templates) which provides a quick lookup to the XML.
For example, this mightwork.
XML like:
<constants> <entry id="123> <name handle="email">Email</name> <value>user@domain.com</value> </entry> </constants>
Create a key
:
<xsl:key name="constants" match="/data/constants/entry/value" use="../name/@handle"/>
And use it:
<xsl:value-of select="key('constants', 'email')"/>
This is from memory so might not work first time…
A couple useful extensions for this (in case you do create a section):
Create an account or sign in to comment.
Hi,
I would like to be able to set values in the admin interface that i can re-use like the email address and phone number. So, for example if the site email changes i can change it in one place and it updates site wide.
I was thinking i could create a section called ‘constants’ with 2 fields, ‘name’ and ‘value’. But how could i reference the ‘value’ field in the XSLT ?
I hope I’ve been clear
Thanks