dqy006150 2014-12-14 16:12
浏览 60

来自level up目录的include.php没有CSS

I've searched around and found people with similar problems, but nothing suggested seems to work for me.

Here's my file structure...

CSS
  > style.css
INCLUDES
  > header.php
  > footer.php
IMGS
index.php
contact.php
about.php
terms.php
MUSEUM-PAGES
  > dummy.php

the header.php which contains the link to css works fine for any html/php page that isn't nested in a sub-directory.

But when I use a sub-directory to better organise the files it falls apart. In this example museum-pages > dummy.php can't bring in the css. The content from the header and footer work fine, just not the CSS files.

I tried replacing the

<link rel="stylesheet" href='css/style.css' type="text/css" media="screen" title="no title" charset="utf-8"> in the header.php to...

/css/style.css
.
../
../../

but it will drop all non-sub directed references in other pages, such as the homepage. I am baffled. Anyone able to help me please?

  • 写回答

2条回答 默认 最新

  • du9537 2014-12-14 16:15
    关注

    This should work fine?

    <link rel="stylesheet" href='/css/style.css' type="text/css" media="screen" title="no title" charset="utf-8">
    

    The / is 'root'

    EDIT

    Since this didnt work, you could try this below, it isnt good practice IMHO however.. it will work.

    <?php
    
    // this is your header.php file
    
    $linkToCss = "http://yoursite.com/css/styles.css";
    
    ?>
    
    <link rel="stylesheet" href='<?php $linkToCss; ?>' type="text/css" media="screen" title="no title" charset="utf-8">
    

    If that doesn't work there is another issue going on - try it see if it works.

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么