Raaman Rai
Raaman Rai

Reputation: 215

joomla 2.5 controller actions

please tell me where the actions in a joomla 2.5 controller written. in joomla 1.5 i remember we use to write the actions like add, edit, remove, cancel etc in the only controller. but i am puzzled in joomla 2.5 because i find three controller even for helloworld component. and i also don't find the functions for actions defined in the controller. i saw only display function in the main controller.

then i also wanna know how each JToolbar button is mapped to an action in the controller.

Upvotes: 0

Views: 395

Answers (1)

Jobin
Jobin

Reputation: 8282

First of all those methods are not shows in the controller that means its in library section.

For your requirement you can create new or same methods in any of the controller If you use same methods like save(), delete() cancel() etc its will override the Joomla's default functions.

In your toolbar section you can have mention the function name as well.

JToolBarHelper::title('Yor custom component', 'head vmicon48'); //set title
JToolBarHelper::apply('saveConfig'); //when the apply button click its will call the saveConfig function the controller.
JToolBarHelper::cancel();

For some toolbar button argument order may different you can find here.

Also if you have more than one controller from your form you can mention the controller like as follows.

<input type="hidden" name="option" value="com_helloworld" />
<input type="hidden" name="view" value="yourview" />
<input type="hidden" name="task" value="my_controller_fun" />
<input type="hidden" value="your_controller_file_name" name="controller">

Hope you will get some idea !

Upvotes: 1

Related Questions