Praveen Solanki
Praveen Solanki

Reputation: 46

Custom Button on Joomla 2.5

I added custom button on my view.html.php file of VIEW of my component as :

JToolBarHelper::custom('addtrack', 'addtrack.png', 'addtrack_f2.png','Add Track', false);
JToolBarHelper::custom('edittrack', 'edittrack.png', 'edittrack_f2.png','Edit Track', false);

JToolBarHelper::custom('updatetrack', 'updatetrack.png', 'updatetrack_f2.png','Save Track', false);

but i dont know from where i can use this buttons, i mean i want to open my respective pages which i created under the same view.

"track_addtrack.php"

or i can do some part of work using this button.

Upvotes: 1

Views: 3064

Answers (1)

Søren Beck Jensen
Søren Beck Jensen

Reputation: 1676

The buttons will execute a task so you have to implement it in your controller.

so in /controllers/{view_name}.php you need to add functions that match your custom names given in the buttons.

Example

class YourcomponentControllerYourview extends JController {

    public function addtrack() {

        //Put code you want to execute here 
        //You could forexample require_once(JPATH_COMPONENT_SITE.'/views/yourview/track_addtrack.php');

    }
}

Upvotes: 2

Related Questions