Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "Class HTML not found" error in Laravel 4

Tags:

php

laravel

Working on a new project in Laravel 4 (a.k.a Illuminate) I'm trying to create the link to the style sheet in my master.blade.php template like so:

    {{ HTML::style('css\style.css') }}

But this throws an error saying the class HTML wasn't found. Has it been removed or renamed in Laravel 4, or am I forgetting anything else?

like image 905
Matanya Avatar asked Jan 07 '13 09:01

Matanya


2 Answers

The generator type classes such as HTML:: and Form:: have been removed from L4 for best practice reasons. It would be better to render as tag using the path() method to link the attribute :

<link href="{{ path('to/my/style.css') }}" />

They may be added in later for backwards compatibility, we will see. Please remember that L4 is currently in an alpha state.

Thanks! Dayle Rees.

like image 112
daylerees Avatar answered Sep 21 '22 06:09

daylerees


They just bring it back in Apr 02, 2013, But use Html instead HTML

eg. {{ Html::style('css\style.css') }} (now they change it again, this is not working anymore)

Refer: Add missing HTML::script and HTML::style

Update : Its "HTML" again!!! (Thanks @milad-rey)

for now please use this {{ HTML::style('css\style.css') }}

Refer: Updates for the rename of the HTML facade.

like image 36
iicmaster Avatar answered Sep 20 '22 06:09

iicmaster