我知道在共享主机上托管laravel 5应用程序可能会很棘手,但这不是不可能的。在共享主机上托管laravel 5应用程序:获取js错误“tinymce未定义”
所以我跟着这个教程的说明 https://medium.com/laravel-news/the-simple-guide-to-deploy-laravel-5-application-on-shared-hosting-1a8d0aee923e
我感动的应用程序文件到一个名为/reddit/
outisde /public_html/
目录和文件的应用程序的/public/
文件夹内到托管的/public_html/
然后我做了改变index.php
在/public_html/
指向正确的路径
ini_set('eaccelerator.enable', 0);
require __DIR__.'/../reddit/bootstrap/autoload.php';
$app = require_once __DIR__.'/../reddit/bootstrap/app.php';
该应用程序加载罚款,但是当我尝试提交新的版(Subreddit)/类别要求TinyMCE的编辑器,它不会加载,我得到这个错误在控制台
Uncaught SyntaxError: Unexpected token/create:203 Uncaught
ReferenceError: tinymce is not defined
我肯定的HTML标记指向正确的tinymce.min.js
,因为如果我查看源代码并单击js链接,脚本将在浏览器中加载。
我的应用程序是在这里:http://maghnatis.com
如果你想看看发生了什么事情。
这是我如何对其进行初始化
$(document).ready(function() {
tinymce.init({
selector : "textarea",
menubar : false,
plugins : ["advlist autolink lists link image charmap print preview anchor", "searchreplace visualblocks code fullscreen", "insertdatetime media table contextmenu paste"],
toolbar : "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
});
});
<p>
{!! Form::label('description', 'Description:') !!}
{!! Form::textarea('description', null, ['class' => 'form-control']) !!}
</p>
恐怕这不符合TinyMCE的,而是如何我的应用程序加载的共享主机的js文件的问题。如果我不解决这个问题,我相信我会和其他库一起进入我的js错误。
我可能会补充说typeahead.js
也无法正常工作。即使json响应是肯定的,也不会从数据库检索记录。
http://maghnatis.com/data/subreddits
这是JS代码typeahead.js
$(document).ready(function() {
var subreddits = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: 'data/subreddits',
remote: {
url: 'data/subreddits/%QUERY',
wildcard: '%QUERY'
}
});
$('#remote .typeahead').typeahead(null, {
name: 'name',
display: 'name',
source: subreddits
});
$('#remote .typeahead').bind('typeahead:select', function(ev, suggestion) {
$('.subreddit_id').val(suggestion.id);
});
});
<div id="remote">
<input class="form-control typeahead" type="text" placeholder="Choose a Subreddit" name="subreddit_name">
<input type="hidden" class="subreddit_id" value="" name="subreddit_id">
</div>
什么文件和什么行号引起意外的令牌错误? – Steve
它在'tinymce.min.js'行6 – Halnex