Html helper - get error "Loader' not found"

Permalink
I am inside custom block - file: controller.php.

I want to use html helper Methods :
http://documentation.concrete5.org/api/class-Concrete.Block.Html.Co...

I try code from 5.6 reference:
$html = Loader::helper('html');
$this->addHeaderItem($html->css('test.css'));

OR 5.7 reference:
$html = Core::make('helper/html');
$this->addHeaderItem($html->css('test.css'));

In two cases i get this error:
Class 'Application\Block\HelloWorld\Loader' not found.

2) In general: What the difference between "Core::make" and "Loader::helper"?

siton
 
hutman replied on at Permalink Reply
hutman
If you want to use Loader you need to put

use Loader;

At the top of your controller with the namespace definitions. Core::make should be used for anything it can be, I believe Loader is only there for some backwards compatibility.
ramonleenders replied on at Permalink Reply
ramonleenders
You should really use "Core::make". "Loader::helper" is deprecated and should not be used. If you are doing this code in a controller, you will have to set "Use" statements as "hutman" said. For the Core::make part that will be

use Core;


In view files it should work out of the box. Let us know if you still have troubles after implementing.