【问题标题】:Suitecrm custom template for custom moduleSuitecrm 自定义模块的自定义模板
【发布时间】:2016-08-11 10:06:53
【问题描述】:

我使用模块构建器构建了一个自定义模块。

我想修改我的模块的模板(编辑、详细信息、子面板)。

如何让 Suitecrm 使用其他模板?

谢谢

(Suitecrm 7.7)

【问题讨论】:

    标签: sugarcrm suitecrm


    【解决方案1】:

    这对我有用。

    <?php
    
    require_once('include/MVC/View/SugarView.php');
    
    class AccountsViewEdit extends SugarView {
    
    private $smarty;
    
      public function __construct() {
    
      }
    
      public function display() {
        $this->smarty = new Sugar_Smarty();
        $data = ['a'=> 'a', 'b'=>'b'];
        $this->smarty->assign($data);
        $this->smarty->display('path/custom/template.tpl');        
      }
    }
    

    【讨论】:

      【解决方案2】:

      您需要在模块中创建一个 SugarView,然后重写 display() 方法以返回自定义模板的路径。惯例是将模板保存在模块中的“tpl”文件夹中。

      例如,如果您查看“modules/Accounts/views/view.edit.php”,您只需添加

      class AccountsViewEdit extends ViewEdit
      {
          public function __construct()
          {
              parent::__construct();
              $this->useForSubpanel = true;
              $this->useModuleQuickCreateTemplate = true;
          }
      
          public function display() {
      
              parent::display(); // TODO: Change the autogenerated stub
              return $this->ss->fetch('path/to/your/smarty/template.tpl');
          }
      }
      

      除了位置在 Dashlets 文件夹中之外,子面板几乎相同。以 modules/Accounts/Dashlets/MyAccountsDashlet/MyAccountsDashlet.php 为例。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-04-03
        • 2017-11-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多