Extracting data from a string without explode()?
Posted: Sat Dec 02, 2006 2:56 pm
Hello all,
I have a CMS template that contains tags in the following format:
{-- dynamic_object [objectname] --}
The 'objectname' needs to be extracted and put into a database when a new page is created so that the CMS knows what objects to place on live pages. The number of these tags and 'objectname' will differ from template to template.
I've tried using explode() (first on '{-- dynamic_object [', and then on '] --}' in the resultant array, which I tried to convert back to a string) to extract 'objectname', but haven't achieved much apart from being slightly confused.
Does anyone know of an easier way to do this?
Thanks in advance,
Matt
I have a CMS template that contains tags in the following format:
{-- dynamic_object [objectname] --}
The 'objectname' needs to be extracted and put into a database when a new page is created so that the CMS knows what objects to place on live pages. The number of these tags and 'objectname' will differ from template to template.
I've tried using explode() (first on '{-- dynamic_object [', and then on '] --}' in the resultant array, which I tried to convert back to a string) to extract 'objectname', but haven't achieved much apart from being slightly confused.
Does anyone know of an easier way to do this?
Thanks in advance,
Matt