Issue
I have used a page designer to develop a new page to my website. This page is aimed to showcase a new service offered by my website. I need to include the header and footer as included on all other pages. Usually this is done using @extends('layout')
and @section('content')
and at the end of the page, @endsection
Overall, the whole page looks similar to this
@extends('layout')
@section('content')
@include('pages.random')
\\code here\\
@endsection
After investigation, it appears that the line in layout.blade.php appears to be causing an issue.
<!-- Custom styles for this template -->
<link href="{{ asset('css/app.css?'.time()) }}" rel="stylesheet">
This document that is being referred to has all custom styles for the whole site, but when applied to this specific page - it turns all the text from the designed format, to a really small text, and a completely different color.
Before: Before image
After: After image
I would like to know if there is a way I would be able to isolate the fonts and styles in @extends('layout')
to the header and footer only, and not affect the rest of the page.
Any help appreciated!
Solution
You could accomplish this by passing a variable to @extends
and then add an if check for the <link>
.
Example:
@extends('layout', ['plain' => true])
Then in your layout blade file:
@if ( !isset( $plain ) )
<link href="{{ asset('css/app.css?'.time()) }}" rel="stylesheet">
@endif
This tells the layout blade to load the stylesheet if $plain
isn't set.
Answered By - Jesse
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.