V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
yakczh
V2EX  ›  PHP

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

  •  
  •   yakczh · 2014-03-13 14:15:17 +08:00 · 2573 次点击
    这是一个创建于 3668 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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 条回复    1970-01-01 08:00:00 +08:00
    explon
        1
    explon  
       2014-03-13 14:20:09 +08:00
    自己写一个样式注册与 JS 函数,如果没思路参考 WeCenter
    66beta
        2
    66beta  
       2014-03-13 14:30:07 +08:00
    blade模板里面 {{ HTML::script('js/xxx.js') }}

    应该是的
    imzoke
        3
    imzoke  
       2014-03-13 14:42:01 +08:00
    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  
       2014-03-13 23:01:22 +08:00
    没有什么特殊的,直接嵌入就行了
    yakczh
        5
    yakczh  
    OP
       2014-03-16 10:11:57 +08:00
    @imzoke 因为layout是共用的 , A页面 用了style.css + pagea.css B页面简单,只用了style.css
    这样写对B页面应该不什么影响吧?
    imzoke
        6
    imzoke  
       2014-03-16 13:55:10 +08:00
    @yakczh 不影响,A页面设置section('style')引入page.css,B页面不设置就行。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5232 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 01:25 · PVG 09:25 · LAX 18:25 · JFK 21:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.