zoukankan      html  css  js  c++  java
  • kohana关于Css搜索路径的问题


    Controller::redirect('welcome/index');

    由于kohana路径规则不一样 会导致所有的文件相对和绝对路径失效:如

     <link href="./css/t.css" rel="stylesheet" type="text/css"/> -

    这条路径会直接定位到/controller/welcome/index/css/t.css与实际的路径./views/css/t.css不符合

    解决办法:

    <!-- //新方法: -->
    <style type="text/css">
    <?php 
    //试用php调用css文件:
    include Kohana::find_file('views/css', 't','css');
    ?>
    </style>

    拓展:

    如何寻找模块文件:

     find_file函数是在这个级联系统中寻找,所以直接使用看会不会生效,我的主目录下有一个views/test1视图,我的mymodule模块下也同样有一个。

    include Kohana::find_file("views", 'test1');

    结果调用主目录下的test1函数。

    在我的模块mymodule/views下新增一个mytest:

    include Kohana::find_file("views", 'mytest');

    结果会调用mytest函数 

    以上表明 级联系统的主要特性:优先级不一致。

     级联系统的优势在 无论你在classes文件的位置建一个新的类:kohana都可以搜索到。

     

  • 相关阅读:
    Trapping Rain Water
    Construct Binary Tree from Preorder and Inorder Traversal
    Flatten Binary Tree to Linked List
    Permutations II
    Unique Paths II
    Path Sum II
    Unique Binary Search Trees II
    evdev module-----uinput.py
    evdev module-----events.py
    evdev module-----device.py
  • 原文地址:https://www.cnblogs.com/canbefree/p/3663402.html
Copyright © 2011-2022 走看看