yakczh
V2EX  ›  PHP

laraval 中如果页面模板中用 css 文件,怎么样加到 layout 的 head 里

  •  
  •   yakczh · Mar 13, 2014 · 3077 views
    This topic created in 4446 days ago, the information mentioned may be changed or developed.
    layout是这样的

    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="style.css" media="all">
    </head>

    <body>
    <div id='login' >

    <ul>
    <li> 登录 </li>
    <li> 注册</li>
    </ul>
    </div>
    <div id='main-content' >
    @yield('content')
    </div>
    </body>
    </html>
    6 replies    1970-01-01 08:00:00 +08:00
    explon
        1
    explon  
       Mar 13, 2014
    自己写一个样式注册与 JS 函数,如果没思路参考 WeCenter
    66beta
        2
    66beta  
       Mar 13, 2014
    blade模板里面 {{ HTML::script('js/xxx.js') }}

    应该是的
    imzoke
        3
    imzoke  
       Mar 13, 2014
    layout.blade.php
    <head>
    ...
    <link rel="stylesheet" type="text/css" href="style.css" media="all">
    @section('style')
    @show
    ...
    </head>

    content.blade.php
    @section('style')
    <link rel="stylesheet" type="text/css" src="content.css" media="all">
    @stop

    希望没有理解错 LZ 的意思。
    huafang
        4
    huafang  
       Mar 13, 2014
    没有什么特殊的,直接嵌入就行了
    yakczh
        5
    yakczh  
    OP
       Mar 16, 2014
    @imzoke 因为layout是共用的 , A页面 用了style.css + pagea.css B页面简单,只用了style.css
    这样写对B页面应该不什么影响吧?
    imzoke
        6
    imzoke  
       Mar 16, 2014
    @yakczh 不影响,A页面设置section('style')引入page.css,B页面不设置就行。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2634 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 328ms · UTC 15:49 · PVG 23:49 · LAX 08:49 · JFK 11:49
    ♥ Do have faith in what you're doing.