why should i use a component instead of an action that renders a partial?
If actions can render partials, when is better using components?
Give me light about it..
Javi
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.
components are used when you want to include some kind of block in different parts of the site (for example, a “Top 10 Sales” or something similar) – that requires some controller code to render. You include a component’s output in another template of an action / partial / another component by using
include_component($module_name, $component_name, array('var1' => $var1));an action is supposed to be called directly by the browser , so you can’t include it’s output in another template (without some kind of hack)
Think of components as a reusable block of html that can get included anywhere, vs actions that are the whole page rendered and sent to the browser