vendredi 18 décembre 2015

Laravel blade template problems

I have a bit of experience with laravel and blade, but this one I just don't see...

The problem is that when I use sub-sub-pages the css won't work anymore

the view-hyerarchy:

  • pages
    • catalogue
      • catalogue_index.blade.php
      • catalogue_details.blade.php
      • catalogue_list.blade.php
    • catalogue.blade.php
    • index.blade.php
    • random.blade.php
  • layout
    • master.blade.php
  • partials
    • nav.blade.php

So I made a nice basic website, there is a master-page which includes the nav-bar and yield the content. No problemo.

Than I made a sub-master-page of the catalogue.blade.php page.

@extends('layout.master')
@section('content')

      @yield('catalogue')

@endsection

The above code is the only content in it. Than I use the content in the catalogue-directory to fill the catalogue.blade.php page.

First I get the content of the catalogue_index.blade.php-page.

@extends('pages.catalogue')
@section('catalogue')

   <h2>@lang('catalogue.title')</h2>

   <ul>
       <li><a href="{{ route('route_catalogue_cable') }}">cables</a></li>
   </ul>
    @endsection

This works...as you see here on this printscreen

But if I use any other page in that directory, the css will be gone...

Than when I click on a menu, to give an example: menu cables (kabel in my language) it's gone... it's just gone...

To show you, I will copy the code below:

@extends('pages.catalogue')
@section('catalogue')

<h2>@lang('catalogue.title')</h2>

<hr/>

<style>

    li a {
        display: block;
    }

    li:hover {
        background-color: #31708f;
        color: #FFF;
    }

    li a:hover {
        background-color: inherit;
        color: inherit;
    }

</style>

<div class="panel-group">
    <div class="panel panel-default">
        <div id="test" class="panel-heading">
            <h3 class="panel-title">
                </span>Naam</a>
            </h3>
        </div>

        <ul class="list-group">
            @foreach($kabelTypes as $type)
                <li class="list-group-item hover">
                    <a id="test" href="{{ route('route_cataloog_kabel_type', array($type->id)) }}">
                        <strong>
                            {{ $type->type }}
                        </strong>
                    </a>
                </li>
            @endforeach
        </ul>
    </div>
</div>

@endsection

I had to switch a few words from language for this question so if a made a typo it will be probably right in my code.

The solution must be easy, I just don't see it. If anyone can help me I would appreciate it alot!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire