473,699 Members | 2,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2873
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******@veriz on.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.infosystem s.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******@veriz on.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
6686
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. When I ran this file under Windows 2003, I got following error message The include file “Include/adovbs.inc” cannot contain ‘…’ to indicate the parent directory. I changed to following lin <!--#include File="my virtual...
18
2628
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> Assume that this library will be used by other groups. I think the answer
15
7397
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 : *************** consumer.php : <? include "inc.php" ?> inc.php : <? include "Common/functions.php" ?>
1
5458
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. ------------------------------------------------------------------------ D:\libnet\sample>gcc tcp1.c In file included from tcp1.c:36: libnet_test.h:12:31: ../include/libnet.h: No such file or directory In file included from tcp1.c:36: libnet_test.h:24: parse error before "enet_src"
3
2705
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 directories contain a file named "cppfile1.h". In my main project I #include "cppfile1.h". I rely on the order of paths in additional include directories list to get file cppfile1.h from ProjectA and
13
2573
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 code : <?php include("../inc/connect.php") ; ....
11
26608
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 and PEAR is in c:\wamp\php\pear I modified php.ini in the c:\wamp\php directory to reflect the actual path, but even stopping and restarting my server shows the c: \php5\pear path. I can't change it no matter what I do I also tried the...
2
3787
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 reference. Cheers Dave
12
2539
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 open stream: No such file or directory in /home/games4w/public_html/games/system.class.php on line 430 The thing is some pages aren't. On the pages that display the error, it's not loading up my content either (flash games). I talked to my...
0
8704
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8623
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9054
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8940
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7781
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.