when i am using laravel 4 routing as
Route::get("/home", "HomeController#showHome");
it works fine but when i am using routing as
Route::get("/home/about", "HomeController#showHome");
it loads page but doesn't take css and javascript.i tried using named route as
Route::get("/home/about" array(
'as'=>'home',
'uses'=>'HomeController#showHome'));
this doesn't work either, it also loads page without styles.
Use css code as below:
{{ HTML::style('css/css.css'); }}
Related
I'm new to Laravel and I've just started my first project using WAMP, however, the special php tags, (#section, #extends, #stop), and all the other tags are displayed as a string.
I've switched Laravel's error variable to true and it still comes up as a string. I've checked Laravel's welcome.blade in my browser and although the html and css are working fine it displays the # tags. I've also tested the server by including and that works fine. I've checked everywhere online and there's no answers to this problem.
Here's an example:
#extends('layout')
#section('content')
Users!
#stop
This displays:
#extends('layout') #section('content') Users!
Any help please?
If you have blade file in a folder you need to add a folder name in extends
#extends('folder_name.layout')
I am trying to add a new view to my laravel project, and it is just dumping the entire content on the page, including my blade code, instead of executing said code. For example, my page in the browser is this:
#extends('user.layouts.app') #section('title', 'New Reminder') #section('content')
New Reminder
#csrf
Title
Content
#endsection
When it should obviously be executing that code, not putting it on the page.
I have tried clearing the routes, and researched around but no dice.
I am calling this view the same way I am calling others in my code - in the controller like this:
return view('user.partials.stat_types.new_type');
Any help or advise is appreciated!
You must have the file name with the extension .blade.php if you want Blade to be used to compile the view. With just .php the PHP engine is used.
Change your view filename to have the .blade.php extension.
I cant find layout.blade.php only welcome.blade.php. I installed a 5 project laravel 6, 5.8 , 5.4 and the same problem. I'm using wampserver but for laravel 6 I need php 7.2+ so I uninstalled it and reinstalled it and the problem began where i cant find layout.blade.php.
please someone help me
Its not default file.you can add it in every folder you like in view.
Create blade view and just write #yield('YourContentName) in where you like that will render by childs.
Its too simple.
you must make a file in resources where this model will be the base for other templates, and in this base template you can put css and a basic HTML structure, for example the basic bootstrap template.
Use php artisan ui bootstrap --auth from https://laravel.com/docs/6.x/frontend#introduction
Create a directory in views called layouts and then add app.blade.php to it. So it would be resources/views/layouts/app.blade.php. Add your layout to that file, something as simple as to start if you like:
<html>
<head></head>
<body>
#yield ('content')
</body>
</html>
Then in your welcome.blade.php you want:
#extends ('layouts/app')
#section ('content')
<p>Stufff here will show within the yield.</p>
#endsection
I am working with Laravel and created a master.blade view file to use on all my pages.
The master view yields mini-views inside.
On most mini-views everything works fine, but on some, I don't get the background image from the master.
The problem is I still get the nav-bar and the footer on those pages, which means they do recognize the master view.
What can be the reason for that?
On all pages I use the exact same way to include and to yield:
#extends('master')
#section('content')
#endsection
Thanks alot!
Just use full path to your file, start with /
I use javascript(Angular.js) with laravel
<aside data-ng-include=" {{ asset('layout/nav') }} " id="nav-container"></aside>
but is error:NotFoundHttpException load no path,
What can be read into the .php file?
Im a little confused on what you are trying to do, but it seems that you are using asset() to link a directory. I would use the laravel function link_to() instead, since it is made to generate links to paths.
Here is the link to the laravel documentation with more information on link_to() and asset():
http://laravel.com/docs/4.2/helpers#urls