473,388 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Help with "../", #include path!! (EXPERT PLEASE)

I have two folders in my website...

Folder1 (this is where my #include file is, this is where the style.css is)
--Folder2

(Folder2 is inside of Folder1)

Folder2 contains a file that has this #include statement...

<!--#include file="../include.inc"-->

....obviously the include.inc file is not in the same folder as the HTML
file.

The problem is, that the include.inc also contains this CSS statment...

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

....And obviously the path does not have "../" in front of it which means it
is looking inside of
Folder2 for the style.css file. And it doesn't exist there. It is only in
Folder1.

I realize I could solve the problem by putting using the full path like
this...

<link rel="stylesheet" type="text/css" href="/project1/Folder1/style.css" />

....but that would mean that this whole site would have to be in a specific
folder
in order to be run properly. This is unacceptable for this particular
project.

I could also solve the problem by making a duplicate copy of the style.css
file
and putting it in the Folder2 folder, however, I don't want the extra
maintenance
hastle of having to remember that when I change one of the style.css files I
have
to also change the other.

Any other suggestions!?? Help!!?
Jul 20 '05 #1
4 2835
michaaal wrote:
I could also solve the problem by making a duplicate copy of the style.css
file
and putting it in the Folder2 folder, however, I don't want the extra
maintenance
hastle of having to remember that when I change one of the style.css files I
have
to also change the other.


What OS? You could use a symbolic link to make the "copy" if you're on a
real OS.

--
Mark.
Jul 20 '05 #2
On Fri, 02 Jul 2004 13:24:51 GMT, "michaaal" <re******@verizon.net>
wrote:
I have two folders in my website...

Folder1 (this is where my #include file is, this is where the style.css is)
--Folder2

(Folder2 is inside of Folder1)

Folder2 contains a file that has this #include statement...

<!--#include file="../include.inc"-->

...obviously the include.inc file is not in the same folder as the HTML
file.

The problem is, that the include.inc also contains this CSS statment...

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

[and the for the stylesheet URI is wrong in the resulting document]

One possibility you might like to try is to set an environment
variable in your Apache configuration (assuming you're using Apache)
and reference it in the include file.

You could either choose to store the "base URI" of the site in there,
which would make some very odd-looking comment-within-tag markup, or
just put the entire link element in there, which is also perhaps the
more flexible solution since you can then change this entire element
just by editing your config, and the stylesheet won't have to "live"
in the same place relative to the documents:

In httpd.conf,
SetEnv STYLESHEET_REF <link ... href="/path/to/style.css" />
(include the full link element; I just shortened it to keep the line
length sensible)

then, in your include file,
<!--#echo var="STYLESHEET_REF" -->

the SetEnv directive is provided by the mod_env module, so you'll need
that loaded. You can use it from an .htaccess file if you can't or
would rather not mess with the global server config.

Note that this question isn't really an HTML question! You might get
better answers if you ask in one of the comp.infosystems.www.servers.*
groups, and state which server you are running.

The above answer could be applied to other servers, but you'll have to
figure out how to set that environment variable yourself.

-Claire
Jul 20 '05 #3
michaaal wrote:

Folder2 contains a file that has this #include statement...
<!--#include file="../include.inc"-->
The problem is, that the include.inc also contains this CSS statment...
<link rel="stylesheet" type="text/css" href="style.css" />

...And obviously the path does not have "../" in front of it which means it
is looking inside of
Folder2 for the style.css file. And it doesn't exist there. It is only in
Folder1.

In the include file:
<link rel="stylesheet" type="text/css" href="./Folder1/style.css" />

If you maintain the same subfolder naming and placement scheme, this
works wherever you put it.

--
jmm dash list at sohnen-moe dot com
(Remove .TRSPAMTR for email)
Jul 20 '05 #4
Tim
On Fri, 02 Jul 2004 13:24:51 GMT,
"michaaal" <re******@verizon.net> posted:
The problem is, that the include.inc also contains this CSS statment...

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

...And obviously the path does not have "../" in front of it which means it
is looking inside of
Folder2 for the style.css file. And it doesn't exist there. It is only in
Folder1.


If you have "folder1/page" and "folder2/other" both "folder1/something" and
"folder2/else" can refer to "folder2/css" by "../folder2/css". In one case
it's backing out and going into the other folder, in the other case it
backs out of the current folder, then goes back into it.

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please delete some files yourself.
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Charts | last post by:
I recently upgraded development web server to Windows 2003. I have ASP file contains following line for include file <!--#include File="../Include/adovbs.inc"-- This ASP file worked fine before....
18
by: Tuckers | last post by:
My question is, if I have created my own library which lives in its own install directory, to refer to its header file is it better to use #include "MyLibrary.h" or #include <MyLibrary.h> ...
15
by: tom pester | last post by:
Hi, Im new to php and have a background in asp. All the help is very much appreciated. today I was using the include function in a file that itself gets included : ***************...
1
by: Intaek LIM | last post by:
hi guys. i just got a library for generating packets. but, i can't compile the example source because of bad include path. ...
3
by: Arpi Jakab | last post by:
I have a main project that depends on projects A and B. The main project's additional include directories list is: ...\ProjectA\Dist\Include ...\ProjectB\Dist\Include Each of the include...
13
by: alex | last post by:
Hi, I've got a php script located at : http://localhost/browse/script.php This script is "URL-rewrited" as http://localhost/welcome.htm This script includes other scripts with the following...
11
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package...
2
by: dave6502 | last post by:
Struggling newbe here, some of my #includes work, some dont. Is it possible to list the include path ? (in BASH), I have looked at the environmental variables (loads of them) but cannot find a...
12
by: Gutspiller | last post by:
I am new here (Hello!), I am trying to fix a problem that some of the pages of my site are displaying the following error: Warning: getimagesize(./swf/FWG Bridge_july_4th_2008.swf ) : failed to...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.