When creating a magento module i sometimes need store config values for use in a template file. Where would be the best place for this – should I create a model or is a helper or block good enough?
I thinking in terms of best practice?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would say a helper because it is accessible from everywhere. It wouldn’t be hurtful to place in a block if it’s only ever used in that block or it’s template, although there is not much reason to create a block just for this when a helper will do.
A model should only be used to model things. As a rule of thumb I only use models for objects that might be used in a data structure, not as a convenience holder for functions.