【问题标题】:SuiteCRM parse error when trying to add a js file to a view尝试将 js 文件添加到视图时,SuiteCRM 解析错误
【发布时间】:2017-01-05 23:00:14
【问题描述】:

我只是想将 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 FastCGI sent in stderr: "PHP message: PHP Parse 错误:语法错误,文件意外结束 /usr/share/nginx/html/custom/modules/Accounts/views/view.edit.php 上 第 31 行”,同时从上游读取响应标头,客户端:x.x.x.x, 服务器:,请求:“获取 /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

有什么想法吗?

【问题讨论】:

    标签: php sugarcrm suitecrm


    【解决方案1】:

    根据 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;
    
        }
    }
    

    【讨论】:

    • 就是这样。谢谢
    猜你喜欢
    • 1970-01-01
    • 2018-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-07
    相关资源
    最近更新 更多