I have a PHP variable that contains HTML. I need to check for occourances of a string, and have that string replaced with the result of a function.
The function has not yet been written, but will only require one variable passed to it which will be the ID of the product.
For instance, the website has products, I want the user to be able to type something into the wysiwyg editor like {{product=68}} and it will display a preset div container with the information for that product. In this case the product has ID 68 in the database, but it could be anything from 1 to whatever.
I thought about creating an array of product id's and searching for the first part of the string, but felt it may be rather cumbersome, I think one of our resident reg exp genius may be able to shed some light on what i need to do.
So the question is... how do i search a string for occourances of {{product=XXX}} where XXX can be an integer higher than one, capture that number, and pass it to a function which creates the replacement string which ultimatley replaces the occourance of the string ?