سؤال

I am working on restyling a phpbb board. Even if there is a support forum on the phpbb platform, I would like to ask for your kind help.

I managed to include a footer.php file into overall_footer.html. The paths are:

WEBSITE/forum/styles/stylename/template/overall_footer.html
WEBSITE/footer.php

the function: <!-- INCLUDEPHP /../../../../footer.php -->

The problem is that, while in other pages footer.php correctly refers to the stylesheet located in

WEBSITE/stylesheet.css

once included in the board it does not refer to it at all... If I add the traditional <link href="...." rel="stylesheet" to footer.php, the stylesheet then applies to the whole board (that should have css defined by the chosen theme). What is the obvious thing that I just can't see? Any help is truly appreciated! Mya

هل كانت مفيدة؟

المحلول

You are better off referencing your assets relative to a known point on your site.

There are several techniques for this... like:

Use the document root as your starting point

include ($_SERVER["DOCUMENT_ROOT"] . "/includes/myfunctions.php");

or set up a constant

define("APP_ROOT", $_SERVER["DOCUMENT_ROOT"]);

or even in a .htaccess file

SetEnv APP_ROOT "/path/to/myroot";

For URL based includes (js /css/ hrefs)

Always use absolute paths when referring to assets on your site (beginning with a /) except for images and fonts loaded from within a css file, those can be loaded relative to the css file.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top