Support the ongoing development of Laravel.io →
posted 11 years ago
Views

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.

Last updated 3 years ago.
0
<link rel="stylesheet" href="{{ asset('assets/css/bootstrap.min.css') }}">
Last updated 3 years ago.
0

@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.

Last updated 3 years ago.
0

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!

Last updated 3 years ago.
0

@AndrewBNZ What a silly mistake i was doing. I'd just forget to include those 'echo' in my statements. Thanks a lot once again.

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.