Monday, May 13, 2013

Creating custom view for SugarCRM

Hi,
From last few days, i was active on SugarCRM product and searching for the customizing its properties.
I found out how to customize the view layer.

Step 1: Create Custom module in customer dir
i.e. custom/modules//controller.php

controller.php file responsible for the redirection of view file.

ex:


class your-module-nameController extends SugarController {

    public function action_test() {
        $this->view = "welcome";  //call for the view file in views dir
    }
}


Step 2: create views dir i.e. custom/modules//views/view.welcome.php

code:

class your-module-nameViewWelcome extends SugarView {
     function
your-module-nameViewWelcome(){
         parent::SugarView();
     }


    public function preDisplay(){
        $this->dv->tpl = 'custom/modules//tpl/welcome.tpl';
    }


    function display(){
         $smarty = new Sugar_Smarty();
         parent::display();
         $smarty->assign("welcome", 'welcome');
         $smarty->display($this->dv->tpl);
    }
}

Step 3: create tpl file inside custom/modules//tpl/welcome.tpl

{ $welcome } To TPL Page


your will access the page via:

http:///module=&action=test

then you will see your template.

I hope this information would help you :)





2 comments :

Anonymous said...

hi,
iam a very beginner for sugar crm. please help me for full basic element for developer.if u have any document or online references. please share with me

Tarun Kumar Singhal said...

Hi,
For SugarCRM, please refer to the online user guide documentation.. Its the only doc that will help you a lot.

Link:
http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_7.2/