0

Somebody told template read content from model via block.

My question:

1.Have any possibility to read content directly from model?

2.If Is this possible,How can I achieve?

3.In which situation, block interact with template and model?

4.If I using only template and model, have any drawback in this?

1

Yes, you can get Model any where in magento, by this code

Mage::getModel('module/module')->getCollection();

If you get model in view(template) file then site loading time will increase.

So the standard way in MVC is create collection in model, get it from block and call it in template file.

Cheers

  • ok. Have any possible reason for increasing execution time? – Ajitha Ms May 14 '14 at 11:53
  • @user6085 increasing execution means, you need to speed up the site? – MeenakshiSundaram R May 14 '14 at 12:00
  • Sorry for my mistake. My question is Have any possible reason for decreasing execution time when we directly use model? – Ajitha Ms May 14 '14 at 12:04
  • If you use directly, you can't speed up the site. So follow the MVC Pattern to increase to speed up the site. – MeenakshiSundaram R May 14 '14 at 12:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.