尝试将 js 文件添加到视图时 SuiteCRM 解析错误
SuiteCRM parse error when trying to add a js file to a view
我只是想将 jquery 和 jquery.maskedinput 添加到帐户模块的自定义编辑视图中。我看到一个post解释这个: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 FastCGI sent in stderr: "PHP message: PHP Parse
error: syntax error, unexpected end of file in
/usr/share/nginx/html/custom/modules/Accounts/views/view.edit.php on
line 31" while reading response header from upstream, client: x.x.x.x,
server: , request: "GET
/index.php?module=Accounts&action=EditView&return_module=Accounts&return_action=DetailView
HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "x.x.x.x",
referrer: "http://x.x.x.x/index.php?action=ajaxui"
有什么想法吗?
根据 php 文档,heredoc 标识符不应缩进。看看JS;
前面怎么没有space?
$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;
}
}
我只是想将 jquery 和 jquery.maskedinput 添加到帐户模块的自定义编辑视图中。我看到一个post解释这个: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 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected end of file in /usr/share/nginx/html/custom/modules/Accounts/views/view.edit.php on line 31" while reading response header from upstream, client: x.x.x.x, server: , request: "GET /index.php?module=Accounts&action=EditView&return_module=Accounts&return_action=DetailView HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "x.x.x.x", referrer: "http://x.x.x.x/index.php?action=ajaxui"
有什么想法吗?
根据 php 文档,heredoc 标识符不应缩进。看看JS;
前面怎么没有space?
$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;
}
}