So I have this $product.description inside a template file that contains the text from Product Description field. What would be the right way to work on this variable and produce derivatives? For example, I may want to filter numbers from that field or cut it and produce a new variable like $product.description_filtered. Text operations are easily done in PHP, but how do I actually create this variable so that my .tpl file can see it and display it? Do I need to create a new module? Do I need to use any hooks? What is the easiest and the most correct way to extend a variable?
Edit History
So I have this $product.description inside a template file that contains the text from Product Description field. What would be the right way to work on this variable and produce derivatives? For example, I may want to filter numbers from that field or cut it and produce a new variable like $product.description_filtered. Text operations are easily done in PHP, but how do I actually create this variable so that my .tpl file can see it and display it? Do I need to create a new module? Do I need to use any hooks? What is the easiest and the most correct way to extend a variable?