Insert an EZPage into Product Descriptions or other Pages
Greetings,
I'm working on a new site that uses common statements for some of the product descriptions (Ex. This product is Certified Organic). This statement is in addition to the specific description of each product.
I would like to create the ability to insert an EZpage (that has the common statement) into products descriptions. This way, if one needs to change the common statement, it is done on the EZpage, not ALL of the products descriptions!
Also, if I'm going to do this, I might as well have the ability to add an EZpage to any of the define pages or even other EZpages (except for the EZpage that is inserting it's self). I think this may make a good Plugin too!
Here's my thinking, I would use a template style placeholder that has the EZPage IDs as it's value.
Example:
1. Here is a product description an I want to insert a few EZpages here {{12, 24, 2}} and maybe one here {{3}} as well!
Or if easier to code
2. Here is a product description an I want to insert a few EZpages here {{12}}{{24}}{{2}} and maybe one here {{3}} as well!
I have the logic flow sort of figured, but not the PHP skills to code without help! My thinking is to break apart the description into an array at the placeholders and store the placeholders in a 2D array (to support multi ID's per placeholder). Then, loop through the placeholders 2D array, striping out the IDs and make the EZpage calls, concatenate the results into a new 1D array. This would now leave you with two 1D arrays that can now be re-assembled.
My initial hurtle is how one would go about breaking apart the description into the two arrays, product description parts and placeholders with the IDs of the EZpages? If one could think of a better approach, I'm open!
Experience is what you get when you don’t get what you want…
Bookmarks