I'm using Smarty and PHP. If I have a template (either as a file or as a string), is there some way to get smarty to parse that file/string and return an array with all the smarty variables in that template?
e.g.: I want something like this:
$mystring = "Hello {$name}. How are you on this fine {$dayofweek} morning";
$vars = $smarty->magically_parse( $string );
// $vars should now be array( "name", "dayofweek" );
The reason I want to do this is because I want users to be able to enter templates themselves and then fill them in at a later date. Hence I need to be able to get a list of the variables that are in this templates.
Let's assume that I'm only doing simple variables (e.g.: no "{$object.method}" or "{$varaible|function}"), and that I'm not including any other templates.