what is a component,helper and why are they used, is there other way we can do same thing, what is better?

I like to think of Components as non-member functions for CakePHP Controllers. If you want to reuse certain functions or blocks of code in multiple controllers, you can create a component and add it to all the controllers you want it in. For example, Cake has a component for Sessions which allows you to access session info and functions in different controllers. See Components for more info.

Helpers are like Components, but they help you with your presentation layer (your Views). For example, FormHelper makes it easy to create HTML forms based on your database table schema. HtmlHelper can make it easy to print out HTML elements (like links or lists). See Helpers for more info.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.