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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With