I need a specific equation on some parts of my website, the question is: is it better to create a module, or put all the code in phtml files?
1 Answer
Hello Matheus and welcome to SE.
Adding code to phtml files is NOT the right option if your are adding "logic" to your Magento.
phtml files should only contain code for rendering purpose. In the ideal world, changing your theme and then changing phtml files, should only cause aesthetical changes and nothing more.
If you need to add something just more complex than a "view change", you should write a module and put your logic in a block, helper or model depending on what you are going to do.
-
Thanks Riccardo, I will look some module building tutorials! Commented Jul 19, 2016 at 23:06