Currently using laravel 4.1 in a new project. My problem is, CSS which i'm using in my VIEW files are not loading at all. But, all my JS files are loading properly. My CSS & JS files are in "assets" folder which is inside of "public" folder.
Folder Structure is like this..
-- -public
------------ assets
--------------------- css
--------------------- js
--------------------- img
My Rote which i'm using for this is..
Route::get('/', function()
{
return View::make('landing');
});
The code which i'm using for loading CSS in VIEW file is..
echo "<link href='".asset('assets/css/bootstrap.css')."' ref='stylesheet'>";
When i see source code from browser, i can able to the link properly. But, don't know why it is not loading in broswer.
<link rel="stylesheet" href="{{ asset('assets/css/bootstrap.min.css') }}">
@AnasT No that is not working. BDW, i feel that is related to BLADE template code. But, i'm not using BLADE template. I'm just using plain PHP in my VIEW file.
It is Blade code, but it doesn't matter - echo it out. If it still doesn't work - you need to check the console in your browser and see why it's not loading.
<link rel="stylesheet" href="<?php echo asset('assets/css/bootstrap.min.css') ?>">
Laravel provides these helpers (see also HTML::style and HTML::script) to make life easier, you should use them!
@AndrewBNZ What a silly mistake i was doing. I'd just forget to include those 'echo' in my statements. Thanks a lot once again.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community