laravel ck-editor is not loading in browser - laravel

laravel-ckeditor is not loading in browser, I followed the installation process as described here https://github.com/UniSharp/laravel-ckeditor#publish-the-resources
Also when I open view source in browser and goto the link, it says Sorry, the page you are looking for could not be found.
I have already added registered it to Application Service Providers located in config/app.php as:
Unisharp\Ckeditor\ServiceProvider::class
ran command:
php artisan vendor:publish --tag=ckeditor
without error
and I have initiated ckeditor by jquery selector as:
<script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
<script src="/vendor/unisharp/laravel-ckeditor/adapters/jquery.js"></script>
<script>
$('textarea').ckeditor();
// $('.textarea').ckeditor(); // if class is prefered.
</script>

best suggestion use cdns link
or download put in public folder and you should include Jquery before ckeditor link
or you try this also
<script src="{{base_path().('/vendor/theseer/build.xml')}}"></script>

Related

Adding JS file in Laravel

I added <script type="text/javascript" src="js/app.js"></script> in Blade file. But I am not getting output when I am browsing. I used php artisan view:clear and php artisan optimize:clear command. But the output is as like before.
I added <div id="app"><prayer_time></prayer_time></div>. This is working fine.
How can I solve the issue ?
You are most probably putting the script part outside of the #section block in your template, which in turn does not render anything.
If you only need the script on that particular page, I would suggest using the #push method, like this in your template file:
#push('scripts')
<script type="text/javascript" src="js/app.js"></script>
#endpush
Here you can read more about the #push functionality.

Can't get CKeditor to work with laravel i guess i need to use asset() but i'm not sure how

i downloaded the ckeditor package with composer but when i add <script src="/vendor/ckeditor/ckeditor/ckeditor.js"></script> in blade template it says 404 he can't find it but it exists

Can't get Laravel-Filemanager to work in subfolder on remote server

In my Laravel 5.7 site I use Ckeditor together with Laravel-Filemanager. After following all the installation instructions I got it to work fine locally. No problems att all. But I cannot get it to work in my remote web server.
On the remote server I have placed the Laravel app in a subfolder 2 levels down from the webroot.
In my blade template I have this (I have tried using both asset and url helpers in the option urls and both of them works locally):
<script src="{{ asset('vendor/unisharp/laravel-ckeditor/ckeditor.js') }}"></script>
<script>
var options = {
filebrowserImageBrowseUrl: "{{ url('/laravel-filemanager?type=Images') }}",
filebrowserImageUploadUrl: "{{ url('/laravel-filemanager/upload?type=Images&_token=') }}"
};
</script>
<script>
CKEDITOR.replace('editor1', options);
</script>
When I want to upload an image in my CKeditor by clicking the Browse server button in my local environment it works as it should and the URL looks like this in Laravel File Manager ('laravel/' being the webroot):
http://laravel/laravel-filemanager?type=Images&CKEditor=editor1&CKEditorFuncNum=0&langCode=sv
When I do the same thing in my remote server the URL looks like this:
http://www.myremoteserver.com/subfolder1/subfolder2/public/laravel-filemanager?type=Images&CKEditor=editor1&CKEditorFuncNum=0&langCode=sv
... and all I get is a 404.
I have tried to clear route, config and site caches. I have also tried to copy the URL above in the remote environment and pasting it a new window without the /public/ part.
Is there anyone out there that can guess what is going on? All help would be greatly appreciated.
please share with me how got the ckeditor to upload files when you click send to server because i have being searching for it for about 2 days now yet no solution.
iam using laravel 5.7
and unisharp laravel-filemanager but no solution was found.
I only saw to add config.filebrowserUploadMethod = 'form';
in the ckeditor congi.js but even after adding that i still didn't get any solution.
every other things seems to be working fine.
please i will be glad to receive your assistance
I finally got it to work. I wiped the web server folder clean and uploaded all files again from the beginning manually instead of doing it by cloning the GIT repo. And then it worked. So I actually am not sure what was wrong.
Anyhow I added this snippet below where I wanted the CKeditor in my blade template:
<textarea id="editor1" name="story" class="form-control">{{ $story }}</textarea>
And this near the bottom of the blade template, just before #endsection.
<script src="{{ asset('vendor/unisharp/laravel-ckeditor/ckeditor.js') }}"></script>
<script>
var options = {
filebrowserImageBrowseUrl: "{{ url('/laravel-filemanager?type=Images') }}",
filebrowserImageUploadUrl: "{{ url('/laravel-filemanager/upload?type=Images&_token=') }}"
};
</script>
<script>
CKEDITOR.replace('editor1', options);
</script>
Be sure to publish as per the filemanager instructions:
php artisan vendor:publish --tag=lfm_config
php artisan vendor:publish --tag=lfm_public
And clear caches:
php artisan route:clear
php artisan config:clear
Also check that the vendor folder exists in your public directory with CKeditor and Laravel filemanager folders inside it, otherwise the asset and url helpers will not work. Also check in the dev window (F12 in browser) what your current path is to ckeditor.js.

Laravel - Failed to load resource error 500

I've a problem with my website, the layout load properly (and CSS) but no JS and page in yield.
I've copy paste the layout of my other website, inclued tje JS and CSS file, I do not understand why it does not work while on other sites it's good..
Code for include the JS and CSS file: <script src="{{url('js/jquery.min.js')}}"></script>
As you can see, the page is empty, and this is not normal.
Image of error:
Ahh... ok.
I've forget to DL From:: into my project. Sorry
I had the same problem when I was creating a recent Laravel project however mine was narrowed down too 2 problems. 1 being the JS had an error and 2nd was the way I called it.
I fixed it by doing the following:
<script type="text/javascript" src="{!! asset('js/jquery.min.js') !!}"></script>

Modernizr load how to

My reference to google hosted jQuery seems to want to load as an image somehow:
Also, how is modernizr loading ga.js, plugins.js and main.js? And how do I prevent it from loading the local version of jQuery?
These are my two script tags:
<script src="js/vendor/modernizr-2.6.2.min.js"></script>
<script type="text/javascript">Modernizr.load(['//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js', 'js/less.js']);</script>
See if you have any luck with the following to load the jquery and less scripts:
<script>
Modernizr.load({
load: [
"//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js",
"js/less.js"
]
});
</script>
Update
Also, how is modernizr loading ga.js, plugins.js and main.js? And how do I prevent it from loading the local version of jQuery?
If I'm reading your question correctly, at the moment modernizr isn't loading ga.js, plugins.js or main.js. You would either need to add them to the above load script or reference them with another script tag. Likewise for your local version of jQuery.
Good luck!

Resources