Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialbruce zhang
1,317 PointsCan not load CSS
Hi
I did a route like below: Route::get('/hello/{name?}/{email?}', function($name = 'world',$email = 'world@www.com') { $data = [ 'name'=>$name, 'email'=>$email ]; return View::make('hello1')->with($data); });
and Hello page css link like below: <link rel="stylesheet" href="./css/foundation.css">
however when I load page for testing by the url:
zihai.dev:8000/hello/bruce/bruce@hotmail.com
it says the css not found, then I see the css get url is
http://zihai.dev:8000/hello/bruce/css/foundation.css
looks like it's not point to public/css
how can I make that work?
Thanks Bruce
3 Answers
shezazr
8,275 PointsThere is a Laravel keyword to access the css/js.. search for it in laravel site. i think it might be set in config files..
Ryan Mayo
23,604 PointsSuggest you use Request::root() and remember to do the .JS <script> tag too or you are losing a lot of functionality
<link rel="stylesheet" href="<?php Request::root() ?>/css/foundation.css" />
<script src="<?php Request::root() ?>/js/vendor/modernizr.js"></script>
Anthony c
20,907 Pointsnone of these are working for me
bruce zhang
1,317 Pointsbruce zhang
1,317 Pointsha, got it
can use public_path
Than you :)