I am trying to customise a laravel site. I want a different header layout for the homepage. Please how do I do that.
What I currently have is a master layout which include the header layout. What I need is something like this in this website www.jiji.ng as you can see, the homepage header layout is different from the rest of layout. I need a general header for the site but different header for the homepage.
Below is the Master.blade.php code
#section('header')
#include('layouts.inc.header')
#show
#section('search')
#show
There's a variety of ways of doing this.
You could check the current route name. Give your home page route a name, then do:
#if(Route::currentRouteName() === 'home')
#include('layouts.inc.header')
#endif
You could also have multiple layouts for your app, via the #extends keyword.
Your home page route might do:
#extends('layouts.home')
and the rest of the app would do:
#extends('layouts.app')
You can use #component and you can pass any view into it like this:
#component('header')
#include('your_header')
#endcomponent
Related
Laravel how can I use the require file when using #section('content') method, how can I require the file into the this?
I want to using the menu bar, but I don't know how to separate it.
I have this code
<div class="links">
About Me
Employment History
News
Blog
Nova
Forge
Vapor
GitHub
</div>
can independent to menu.php
Make menu.blade.php with this code in your views directory.
In place of code write #include('menu')
If location of file is different then #include('path-to-file') will be loaded.
In Laravel blade you can use #include('file path')
You can use yield() to solve the problem.
im using the laravel 5.1 and building web app
i just bought HTML theme and directly copy all the css and Js files to public/assets ( not using any task runner such as gulp or grunt). i try to customize the login and register view page and if i use the default routing its fail to load the js and CSS ( just load plain HTML ) but if i point it directly by
Route::get('login','AuthController#getLogin')
its working . how can i fix the JS and CSS problem ?
*all the other pages works right and load the CSS and JS *
here are the screen shots from other pages and login page :
here is from my login page that fail to load :
if i use route to directly link to the page not passing through the Auth controller and after submit send data to login function ( like simple normal forms) its working but if goes through the controller system its fail . also if i use :
Route:resource('contact','contactcontroller')
my contact pages such as index, create , etc all are fail to load CSS but if i directly link to them like:
Route:get('contact','contactController#index')
it will successfully load the CSS and my page will be shows fine .
this question may help you with that !
Laravel stylesheets and javascript don't load for non-base routes
BTW : look at your page with firefox(chrome) Inspect Element Or Firebug to see the http requests!
Try using this way script and style link
{!! HTML::script('js/bootstrap.min.js') !!}
{!! HTML::style('css/bootstrap.min.css') !!}
<link href="{{URL::asset('../assets/css/bootstrap.css')}}" rel="stylesheet">
<script src="{{URL::asset('../assets/js/jquery.js')}}"></script>
I use these methods works 10/10.
my url is http://www.clippingpathoutsource.com and it works fine but when I click to the logo of the page then the url shows http://www.clippingpathoutsource.com/index.php
Could anyone please help me?
it is difficult to identify the problem without looking at the code in the template file...
check the following:
1) In Template check index.php for below block of code
<div class="logoArea">
<a href="/index.php">
2) Instead of "/index.php" in the href attribute of the a tag put your domain name.
I am new to laravel so I am not sure how this can be achieved. I am using ZURB Foundation and trying to create a button in the page.
I use linkRoute always to redirect to a named route then redirect to a specific controller action. I have the below:
<body >
<h1 align="center">ShopCon.com</h1><br><br>
<a style="margin-left:50px;" href="{{ HTML::linkRoute('membersaccess', 'Members Access') }}" class="medium success button">Login or Register</a>
</body>
but when I render this, it shows like this
Members Access" class="medium success button">Login or Register
instead of showing the button and text within it and link to named route. How can this be fixed? I read something about macros but unable to clearly understand them or use them to achieve this.
Picture included for reference:
HTML::linkRoute produces an HTML anchor tag.
Since you only want the URL, use URL::route.
I have a problem withjdoc include head. On any other page than Home, the <jdoc:include type="head" /> result is not complete, it does not include jQuery library etc. but only the title and favicon. Any idea how could I keep the JS libraries and all from jdoc head on all pages, not just the homepage ? I don't know why they get loaded on home but not on login for example, or search...
Thanks.
By default header in Joomla doesn't contain jQuery... It loads Mootools.
If you need to load jQuery you have to use a plugin like this one.