I'll do my best to explain this 🙂
I'm writing a CMS for my own personal use (and to save me time at work 😉 ) but I want to make it as flexible as possible so that I can adapt it to any use I need.
For this, I'm using a template engine that I am writing myself.
The problem I'm currently facing is mapping a "tag" in the templates to an array structure that is created from an XML document.
For example:
<button>
<help>
<imagename>help.gif</imagename>
<alttext>
<en>Help</en>
<de>Hilfe</de>
<fr>Aide</fr>
</alttext>
</help>
</button>
The array structure generated for the "en" alttext is:
$themeconfig['button']['help']['alttext']['en'] // (which contains "Help")
Now, I would like a way of translating a template tag into this structure. Ideally, I would like to put something like this in the template:
{%THEME:button:help:alttext:en%}
.
Is there anyway I can use a single regular expression (PCRE or POSIX, not fussed!) that can handle all possible permutations of this? i.e. can cope with the example above as well as
{%THEME:button:help:imagename%}
for example?
If there is, could anyone give me a hint as I'm stumped? And if not, are there any other ways that this could be done quickly and effectively?
Thanks for any replies, much appreciated 🙂