dounieqi6959 2016-07-04 20:42
浏览 48
已采纳

CSS没有从header.php调用

I had some big problems calling my header at all from project1.php. It got solved with the header included like this:

<?php include $_SERVER['DOCUMENT_ROOT'] . '/vouzalis/resources/includes/header.php'; ?>

The header is now called, but all my CSS is not called. Howcome can that be? On all my pages there is lying in the root folder the CSS is working fine.

My folder structure is looking like this:

Folder structure

This code below is a snip of my header. As you can see Home should go to index.php. But when I am in my project1.php and I click on Home I get the URL: `

http://localhost:8888/vouzalis/projects/index.php

The correct root should be:

http://localhost:8888/vouzalis/index.php

It does not make sense to be. Does anybody have a clue why? Is it something with how the header is included?

<div class="navbar-collapse collapse">
    <ul class="nav nav-pills nav-main pull-right">
        <!-- begin navigation items -->
        <li class="active"><a href="index.php">Home</a></li>
        <li>
            <a href="services_smallicon.php">Services</a>
        </li>
        <li>
            <a href="portfolio.php">Portfolio</a>
        </li>
        <li>
            <a href="aboutme.php">About Me</a>
        </li>
        <li><a href="contact.php">Contact</a></li>
        <!-- end navigation items -->
    </ul>   
</div>
  • 写回答

1条回答 默认 最新

  • doumu1212 2016-07-04 20:59
    关注

    I believe the problem is here:

    <li class="active"><a href="index.php">Home</a></li>
    

    Replace href="index.php" with href="/vouzalis/index.php". The / specifies the domain root, without it, the root is the your current location (/vouzalis/projects/).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler