【问题标题】:Unable to get Bootstrap template to work with master page laravel framework无法让 Bootstrap 模板与母版页 laravel 框架一起使用
【发布时间】:2016-07-06 10:54:06
【问题描述】:

我正在学习如何使用 4.2.0 版本的 laravel 框架。

所以我已经进入了母版页和子页的部分。

我正在尝试从子页面继承母版页的特征。

我的意思是 CSS, JavaScript 标题。

我正在编写一个教程,该教程使我能够使用bootstrap 模板实现这一目标。 Tutorial 我不断收到“哎呀,好像出了点问题。”每当我包含母版页的各个部分时都会出错。

我注意到当我按照教程解释包含不同部分时出现上述错误 这是我尝试过的错误,

main.blade.php
    <!DOCTYPE html>
    <html lang="en">

    <head>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">

        <title>Agency - Start Bootstrap Theme</title>

        <!-- Bootstrap Core CSS -->
        <link href="<?php echo asset('vendor/bootstrap/css/bootstrap.min.css');?>" rel="stylesheet">

        <!-- Custom Fonts -->
        <link href="<?php echo asset('vendor/font-awesome/css/font-awesome.min.css');?>" rel="stylesheet" type="text/css">
        <link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
        <link href='https://fonts.googleapis.com/css?family=Kaushan+Script' rel='stylesheet' type='text/css'>
        <link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700' rel='stylesheet' type='text/css'>

        <!-- Theme CSS -->
        <link href="<?php echo asset('css/agency.min.css');?>" rel="stylesheet">

        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
            <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
            <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->

    </head>
     <body id="page-top" class="index">

            @include('layouts.partials._navigation')

            @include('layouts.partials._header')

            @yield('content')

            @include('layouts.partials._footer')

        </body>
    </html>


_navigation.blade.php

    <!-- Navigation -->
        <nav id="mainNav" class="navbar navbar-default navbar-custom navbar-fixed-top">
            <div class="container">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header page-scroll">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                        <span class="sr-only">Toggle navigation</span> Menu <i class="fa fa-bars"></i>
                    </button>
                    <a class="navbar-brand page-scroll" href="#page-top">Start Bootstrap</a>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav navbar-right">
                        <li class="hidden">
                            <a href="#page-top"></a>
                        </li>
                        <li>
                            <a class="page-scroll" href="#services">Services</a>
                        </li>
                        <li>
                            <a class="page-scroll" href="#portfolio">Portfolio</a>
                        </li>
                        <li>
                            <a class="page-scroll" href="#about">About</a>
                        </li>
                        <li>
                            <a class="page-scroll" href="#team">Team</a>
                        </li>
                        <li>
                            <a class="page-scroll" href="#contact">Contact</a>
                        </li>
                    </ul>
                </div>
                <!-- /.navbar-collapse -->
            </div>
            <!-- /.container-fluid -->
        </nav>

_header.blade.php

    <header>
            <div class="container">
                <div class="intro-text">
                    <div class="intro-lead-in">{{$myname}}!</div>
                    <div class="intro-heading">my location {{$mylocation}} date : {{date('m')}}</div>
                    <a href="#services" class="page-scroll btn btn-xl">Tell Me More</a>
                </div>
            </div>
        </header>

_footer.blade.php


     <!-- jQuery -->
        <script src="<?php echo asset('vendor/jquery/jquery.min.js');?>"></script>

        <!-- Bootstrap Core JavaScript -->
        <script src="<?php echo asset('vendor/bootstrap/js/bootstrap.min.js');?>"></script>

        <!-- Plugin JavaScript -->
        <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>

        <!-- Contact Form JavaScript -->
        <script src="<?php echo asset('js/jqBootstrapValidation.js');?>"></script>
        <script src="<?php echo asset('js/contact_me.js');?>"></script>

        <!-- Theme JavaScript -->
        <script src="<?php echo asset('js/agency.min.js');?>"></script>

child page that i need to inherit master page

        @extends('layouts.main')

    @section('content')

        <!-- Services Section -->
        <section id="services">
            <div class="container">
                <div class="row">
                    <div class="col-lg-12 text-center">
                        <h2 class="section-heading">Services</h2>
                        <h3 class="section-subheading text-muted">Lorem ipsum dolor sit amet consectetur.</h3>
                    </div>
                </div>
                <div class="row text-center">
                    <div class="col-md-4">
                        <span class="fa-stack fa-4x">
                            <i class="fa fa-circle fa-stack-2x text-primary"></i>
                            <i class="fa fa-shopping-cart fa-stack-1x fa-inverse"></i>
                        </span>
                        <h4 class="service-heading">E-Commerce</h4>
                        <p class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.</p>
                    </div>
                    <div class="col-md-4">
                        <span class="fa-stack fa-4x">
                            <i class="fa fa-circle fa-stack-2x text-primary"></i>
                            <i class="fa fa-laptop fa-stack-1x fa-inverse"></i>
                        </span>
                        <h4 class="service-heading">Responsive Design</h4>
                        <p class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.</p>
                    </div>
                    <div class="col-md-4">
                        <span class="fa-stack fa-4x">
                            <i class="fa fa-circle fa-stack-2x text-primary"></i>
                            <i class="fa fa-lock fa-stack-1x fa-inverse"></i>
                        </span>
                        <h4 class="service-heading">Web Security</h4>
                        <p class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.</p>
                    </div>
                </div>
            </div>
        </section>

        @endsection

有人可以帮忙吗,我很困惑为什么这对我不起作用

【问题讨论】:

  • _footer.blade.php 这样的字符串实际上在代码中还是显示了不同的文件拆分?
  • 是的,看看上面的 main.blade.php 代码
  • 这不能回答我的问题
  • 可能我没看懂这个问题,但我只是按照教程做的,请改写你的问题

标签: php twitter-bootstrap laravel master-pages


【解决方案1】:

我只需将包含的文件移动到目录主模板的同一目录即可工作

【讨论】:

    猜你喜欢
    • 2013-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多