I'm developing a piece of software that uses templates and language packs. Language packs are loaded based on which module is being accessed.
The lang vars are all loaded into an array ($lang) which can be accessed by typing $this->lang['language_assignment'];. When users access the templates to make changes I want to make it a little easier on them, so instead of typing the above code for every piece of text they will see things like, {nex.lang.copyright} or {nex.lang.welcometxt}.
Before the content ( with the templates ) is output I run a macro function that finds matches for the above pattern. It looks like this:
function Macro($text)
{
return preg_replace('#\{nex\.lang\.{1}([a-zA-Z]*)\}{1}#si', $this->lang['\1'], $text);
}
Now, ideally this would strip the {nex.lang.language_assignment} and return the proper lang var in it's place.
Instead I get crap like:
Notice: Undefined index: \1 in c:\program files\apache group\apache\htdocs\thenexxus\system\functions.php on line 250
I've tried several methods to return the proper value, but to no avail.
This system really isn't necessary, but it would, however, save my users alot of time and frustration.
Any pointers in the right direction would be greatly appreciated! Thank yoU!