Hello Everyone,
I would like to get some advice or opinions on the best way to proceed on a particular situation.
Here is what I have; and what need to be able to do...
I have a custom content management system that is MySQL database driven. I currently retrieve sections of html content from this database to fill sections of pages on a multilingual website. What I need to be able to do now is to embed code into this stored html; that represent variables that need to be retrieved from another separate table, based upon what the embedded code is, and replace the embedded code with the proper data before the final string is sent to the web server.
What I am currently thinking is that, I will need to parse the returned content string, and do a replacement on that (embedded code). What I would like to be able to do is embed a two part code that will contain the field name and row that needs to be retrieved from the other table. Something like <<<PRICE-312>>>. Price would be the field and 312 would be the row id. Primarily I will be returning current product descriptions and prices that go into the retrieved content string.
I am not very familiar with the different string replacement functions, so if I am on track with my concept, perhaps someone could point me in the right direction as to the best fit for what I am trying to accomplish.
Can I parse a string for my beginning (<<<) and end (>>>) codes, read the two pieces of information between them, do a database lookup, and replace that embedded code all in one step, or will I have to parse for all of the codes in the content string, do the lookups, then go back through it a second time to do the replacements?
If anyone has any ideas or opinions to add, I would really like to hear them. Perhaps there is a better way to handle this situation. I am really open to any other ideas anyone might suggest.
Hopefully someone will tell me that I am making this too complicated, and that I have overlooked something simpler. 8)
Thank you all for any help that anyone might generously give. I know that everyone’s time is valuable.
Marc