dongxin8392
2017-03-21 12:53
浏览 52
已采纳

如何在laravel 5.2中使用HTML5引导程序模板

Master.blade.php

    <!DOCTYPE html>
<html class="no-js" lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="software app site template" />
<meta name="keywords" content="corporate, software, app, business, marketing, site template, web marketing, internate marketing"/>
<meta name="author" content="Tansh" />
<link rel="icon" type="image/png" href="images/favicon.png"/>
<title>Tech-Marquee | @yield('title')</title>


<link href='http://fonts.googleapis.com/css?family=Arimo:400,400italic' rel='stylesheet' type='text/css'>

<!--style sheets-->
<link rel="stylesheet" media="screen" {!!asset('assets/css/style.css')!!}/>
<link rel="stylesheet" media="screen" {!!asset('assets/css/navigation.css')!!}/>
<link rel="stylesheet" media="screen" {!!asset('assets/css/jquery-ui-1.10.3.custom.css')!!}/>

<!--jquery libraries / others are at the bottom-->
<script {!!asset('assets/js/jquery-1.9.1.min.js')!!} type="text/javascript"></script>
<script {!!asset('assets/js/modernizr.js')!!} type="text/javascript"></script>

<!--flexslider scripts starts-->
<link rel="stylesheet" media="screen" {!!asset('assets/css/flexslider.css')!!}/>
<script {!!asset('assets/js/jquery.flexslider-min.js')!!} type="text/javascript" ></script>
<script type="text/javascript">
$(window).load(function () {
    //Image Slider
    $('.image-slider').flexslider({
        animation: "slide",
        slideshowSpeed: 4000,
        animationDuration: 600,
        controlNav: true,
        keyboardNav: true,
        directionNav: true,
        pauseOnHover: true,
        pauseOnAction: true,
    });
});
</script>
<!--flexslider scripts end-->

<!--jcarousel scripts starts-->
<link rel="stylesheet" media="screen" {!!asset('assets/css/jcarousel.css')!!}/>
<script {!!asset('assets/js/jquery.jcarousel.min.js')!!} type="text/javascript"></script>
<script type="text/javascript">
//Image slider for gallery  
$(document).ready(function() {  
$('#mycarousel').jcarousel({
         easing: 'easeInOutQuint',
         animation: 600
});
});
</script>
<!--jcarousel scripts ends-->

<!--prettyphoto scripts starts-->
<link rel="stylesheet" media="screen" {!!asset('assets/css/prettyPhoto.css')!!}/>
<script {!!asset('assets/js/jquery.prettyPhoto.js')!!} type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {  
$('a[data-rel]').each(function() {
        $(this).attr('rel', $(this).data('rel'));
});
$("a[rel^='prettyPhoto[mixed]']").prettyPhoto({
        animation_speed: 'fast',
        slideshow: 5000,
        autoplay_slideshow: false,
        opacity: 0.80,
        show_title: false,
        theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
        overlay_gallery: false,
        social_tools: false
});
});
</script>
<!--prettyphoto scripts ends-->

<!--subscribe scripts starts-->
<script {!!asset('assets/js/jquery.validate.js')!!}  type="text/javascript"></script>
<script {!!asset('assets/js/jquery.form.js')!!} type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {  
$(function() {
        var v = $("#subform").validate({
        submitHandler: function(form) {
        $(form).ajaxSubmit({
        target: "#result_sub",
        clearForm: true
        });
        }
        });
}); 
//To clear form field on page refresh
$('#subform #email').val('');
});
</script>
<!--subscribe scripts ends-->

</head>
<body>
 @yield('header')
 @yield('slider')

<!--section for features ends--> 



<!--section for requirements and gallery starts-->

  @yield('footer')
<script {!!asset('assets/js/jquery.supersubs.js')!!}></script> 
<script {!!asset('assets/js/jquery.superfish.js')!!} type="text/javascript"></script> 
<script {!!asset('assets/js/jquery.cycle.all.js')!!} type="text/javascript"></script> 
<script {!!asset('assets/js/jquery-ui-1.10.3.custom.js')!!} type="text/javascript"></script> 
<script {!!asset('assets/js/jquery.easing.1.3.js')!!} type="text/javascript"></script> 
<script {!!asset('assets/js/twitter.js')!!} type="text/javascript"></script> 
<script {!!asset('assets/js/custom.js')!!} type="text/javascript"></script>
</body>
</html>

I'm using above code to master layout

in home.blade.php

@extends('Layout._master')
@section('title','Creating. Securing Virtual World')
@section('header')
 @include('includes.header')
@endsection
@section('slider')
 @include('includes.slider')
@endsection
@section('footer')
  @include('includes.footer')
@endsection

Routes.php

Route::get("/",function(){
       return view('home');
    });

Still i'm not able to load css and js files in master layout. I copied css and js folder in public/assest folder but it's not working css and js is not loading while going to home.blade.php

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongqie8661 2017-03-21 13:15
    已采纳

    I am assuming your css file is reside inside the public/css folder. then you just write

    <link href="{{ asset('css/style.css') }}" rel="stylesheet">
    

    similarly, your js file inside public/js folder

     <script src="{{ asset('js/app.js') }}"></script>
    

    or

    <script src="/js/jquery-3.1.1.js" ></script> 
    

    Try to include all the files like wise. Hope it will help you.

    打赏 评论
  • doushu5451 2017-03-21 13:13

    I have done a silly mistake in my code.

    i should have use this code

    src="{!!asset('assets/js/jquery.flexslider-min.js')!!}"
    

    and

    href="{!!asset('assets/css/style.css')!!}"
    
    打赏 评论

相关推荐 更多相似问题