If you want take advantage of a helpers via the Laravel HTML component in Laravel 5.x (by default it is not embedded anymore). For detail, you can reference from this links:
https://stackoverflow.com/questions/28541051/class-illuminate-html-htmlserviceprovider-not-found-laravel-5
Firstly, you need to place your assets in the public folder located at your project root, (both public folder of Laravel4 and 5 are located at project root)
For example:
- public/css/style.css
- public/js/jquery.js
- public/images/hello.png
JavaScript
To generate an line of code to call javascript in view:{{ HTML::script('js/jquery.js'); }}<script src="http://localhost/project_name/public/js/jquery.js"></script>
CSS
To generate an line of code to call css style in view:{{ HTML::style('css/style.css'); }}output:
<link media="all" type="text/css" rel="stylesheet" href="http://localhost/project_name/public/css/style.css">
Image
To generate an line of code to call images in view:Code to generate a simple image tag:
{{ HTML::image('images/hello.png') }}Output:
<img src="http://localhost/project_name/public/images/hello.png">Code to generate a image tag with attribute:
{{ HTML::image('images/hello.png', 'calendar', array('id' => 'article_post_fromdate_img','class'=>'calendar')) }}Output:
<img src="http://localhost/beauty_laravel/public/images/hello.png" id="article_post_fromdate_img" class="calendar" alt="calendar">
Reference:
http://stackoverflow.com/questions/13433683/using-css-in-laravel-views
https://laravel.io/forum/09-20-2014-html-form-class-not-found-in-laravel-5
No comments :
Post a Comment