2

I need to use

echo HTML::script('js/ckeditor/ckeditor.js');

in my controller and function, but error not found HTML

I am using larvel 5.0. tnx

1 Answer 1

3

HTML and FORM are removed from Laravel 5+ to use them you have to include them in composer.json. And add an Alias and Service Provider in config\app.php You can find them here

And as from laravel 5 {{}} is same as {{e('sting')}} //htmlentities To output html you need to use {!! HTML::() !!} without htmlentities

And if you need to use echo Simply wrap it to <?php ?> tags <?php echo HTML::() ?>

And if you use it Controller you need to use like \Html::() or before Controller class add use HTML;

HTML or Html depends on you Alias array in config\app.php

composer.json

"illuminate/html": "^5.0",

Config/app.php Service Provider

'Illuminate\Html\HtmlServiceProvider',

Config/app.php aliases

'Form'      => 'Illuminate\Html\FormFacade',
'HTML'      => 'Illuminate\Html\HtmlFacade',

Controller

<?php namespace App\Http\Controllers;
use HTML;
class SomeController extends Controller{
    public function foo(){
        echo HTML::();
    }
}
Sign up to request clarification or add additional context in comments.

4 Comments

notice : my code works in View but does not work in controller.
Why you need it controller? HTML and FORM are made for view. Paste the whole controller code please! Also check you Alias array in app.php you have it HTML or html
This is special situation because i wanna upload image via CKEDITOR and have to use it in my controller.
I Used Illuminate\Html\HtmlFacade\HTML but does not worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.