cancel
Showing results for 
Search instead for 
Did you mean: 

What is the Difference between controller and Blocks

SOLVED

What is the Difference between controller and Blocks

Hi Folks,

 

Another concern is:

 

What is the Difference between controller and Blocks ?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Re: What is the Difference between controller and Blocks

Hi @magento_sage1

 

Below is the main difference between controller and block !

 

Block are responsible for rendering content (everything from frontend, backend, emails, and more). If content is being displayed somewhere chances are it is a block.

 

 

controllers are responsible for processing all requests made via a url. If you hit the url http://www.example.com/catalog/product/view/id/9/ you hit the catalog module in the controllers/ProductController.php and inside of that the viewAction() method. If you hit a URL in Magento the request passes through one or more controllers.

 

 

For more details refer below links : 

 

https://stackoverflow.com/questions/14283920/magento-model-vs-block-vs-controller-etc

 

https://magento.stackexchange.com/questions/19777/relationship-between-block-controller-and-model-ma...

 

Hope it helps !

 

 

if issue solved,Click Kudos & Accept as Solution

View solution in original post

2 REPLIES 2

Re: What is the Difference between controller and Blocks

Please cehck following thread:

 

https://stackoverflow.com/questions/14283920/magento-model-vs-block-vs-controller-etc

Did you find it helpful? Please give "Kudos" or "Accept as Solution".
Meet 70+ extensions and templates for M1 & M2 in one place


Re: What is the Difference between controller and Blocks

Hi @magento_sage1

 

Below is the main difference between controller and block !

 

Block are responsible for rendering content (everything from frontend, backend, emails, and more). If content is being displayed somewhere chances are it is a block.

 

 

controllers are responsible for processing all requests made via a url. If you hit the url http://www.example.com/catalog/product/view/id/9/ you hit the catalog module in the controllers/ProductController.php and inside of that the viewAction() method. If you hit a URL in Magento the request passes through one or more controllers.

 

 

For more details refer below links : 

 

https://stackoverflow.com/questions/14283920/magento-model-vs-block-vs-controller-etc

 

https://magento.stackexchange.com/questions/19777/relationship-between-block-controller-and-model-ma...

 

Hope it helps !

 

 

if issue solved,Click Kudos & Accept as Solution