尝试将js文件添加到视图时SuiteCRM解析错误

时间:2017-01-05 23:00:15

标签: php sugarcrm suitecrm

我只是想将jquery和jquery.maskedinput添加到Accounts模块的自定义编辑视图中。我看到一篇帖子解释了这一点:https://www.suitecrm.co.uk/forum/developer-help/9598-one-of-the-two-required-fields-to-be-filled-in-accounts-module?start=15

我的代码:

<?php

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

require_once('modules/Accounts/views/view.edit.php');

class CustomAccountsViewEdit extends AccountsViewEdit {

public function __construct(){
        parent::__construct();
     }


function display(){

 //call parent display method
 #       parent::display();


$js = <<<JS

            <script src="/admin/custom/include/javascript/jquery.min.js" type="text/javascript">
            <script src="/admin/custom/include/javascript/jquery.maskedinput.min.js" type="text/javascript">
    JS;
        parent::display();
        echo $js;

    }

}

我得到的错误:

  

[error] 1846#0:* 244 stderr发送的FastCGI:“PHP消息:PHP Parse   错误:语法错误,文件意外结束   /usr/share/nginx/html/custom/modules/Accounts/views/view.edit.php on   第31行“从上游读取响应头,客户端:x.x.x.x,   服务器:,请求:“GET   /index.php?module=Accounts&action=EditView&return_module=Accounts&return_action=DetailView   HTTP / 1.1“,上游:”fastcgi://127.0.0.1:9000“,主机:”x.x.x.x“,   推荐人:“http://x.x.x.x/index.php?action=ajaxui

有什么想法吗?

1 个答案:

答案 0 :(得分:3)

根据php文档,heredoc标识符不应缩进。看看JS;之前没有空格?

$js = <<<JS

            <script src="/admin/custom/include/javascript/jquery.min.js" type="text/javascript">
            <script src="/admin/custom/include/javascript/jquery.maskedinput.min.js" type="text/javascript">
JS;
        parent::display();
        echo $js;

    }
}