/    Sign up×
Community /Pin to ProfileBookmark

stylesheet reference in include

I’m trying to reference my stylesheets from within my header include file, but its not working. Its not finding the css file for some reason. If I move the exact same reference and head tags from the include and put it with the html, it finds the stylesheets fine…

This is what is in my header include file…

[CODE]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<meta name=”description”
content=”Sapp Brothers offers you clean travel centers, quality fuel, and the best service any travel center has to offer.” />
<meta name=”keywords”
content=”Sapp Bros Travel Centers Truck Stop diesel gas fuel ” />
<title>Sapp Bros Travel Centers, Inc.</title>
<link href=”/../styletest/mainexample.css” rel=”stylesheet” type=”text/css” />
<link rel=”stylesheet” type=”text/css” href=”/../styletest/style.css” />

<script type=”text/javascript”>var dmWorkPath=”/../styletest/omahahome/js_menu/data.files/”;</script>
<script type=”text/javascript” src=”/../styletest/omahahome/js_menu/data.files/dmenu.js”></script>

[B] <link href=”/../styletest/mainexample.css” rel=”stylesheet” type=”text/css” />
<link rel=”stylesheet” type=”text/css” href=”/../styletest/style.css” />[/B]
</head>
[/CODE]

and the html that calls the include…

[CODE]<?php include(“/../styletest/header.php”); ?>[/CODE]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@15hoursNowauthorFeb 23.2009 — hmm, ok, scratch that, the css references are fine, its not finding the entire header.php file for some reason
Copy linkTweet thisAlerts:
@15hoursNowauthorFeb 23.2009 — i got it
Copy linkTweet thisAlerts:
@VodkaProDrinkerFeb 23.2009 — try this:
[code=php]<?php include("../styletest/header.php"); ?>[/code]
But I have a question, why did you used '/' in the first place?
Copy linkTweet thisAlerts:
@CharlesFeb 23.2009 — &lt;?php include("/../styletest/header.php"); ?&gt;That say go to the server root and then up one from there (which doesn't exist) and then back down to the styletest directory. You want something like &lt;?php include ($_SERVER['DOCUMENT_ROOT'] . '/styletest/header.php") ?&gt;
×

Success!

Help @15hoursNow spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.9,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...