/    Sign up×
Community /Pin to ProfileBookmark

file problems

hi

My images are stored in a folder images which is a sub folder to the root. and in a folder called design which is also a sub folder to the root I have a file called banner. The file banner is included on each page of my web site.

my include statement looks like this for all file held in the root directory

[code=php]
include(‘design/banner.php’) ;
[/code]

the problem I’m having is getting the image to display which is part of the banner on pages that are held within a folder.

code to included the banner on pages held in a folder

[code=php]
include(‘../design/banner.php’) ;
[/code]

my banner code. how do I get the image to always display

[code=php]
<form name=”search” method=”post” action=”../etreasures/searchResults.php”>
<div style=”float:right; padding:2px; background:#20718c;”>
<p><input name=”search” type=”text” style=”font-size:small;” onClick=”this.value=”” VALUE=”Start new search ” size=”20″ />
<input type=”submit” name=”searchSubmit” value=”Search” />
</p>
</div>
</form>
<div style=”width:800px; margin: 0 auto 0 auto; background-image: url(‘images/logo.gif’);background-repeat: no-repeat; background-position: left; height:150px;”>
<div style=”margin-left:200px;”><p style=”text-align:center;”>&nbsp;</p>
<h2 style=”text-align:center;”>KEEP 100% of YOUR CASH</h2>

</div>
</div>
<div class=”bannerBottom”>
<ul>
<li>Today: <? echo date(“Y-M-d”); ?></li>
<li></li>
<li></li>
<li></li>
</ul>
<br clear=”left”>
</div>

</p>
[/code]

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@NightShift58Feb 17.2007 — Use set_include_path() to [B]extend[/B] the search path for include.
Copy linkTweet thisAlerts:
@kprocauthorFeb 17.2007 — thanks for the information,

I did some reading on that function and I cannot figure out how to use it to help me.

do I just change include(page.php)

to set_include_path(page.php)

thank you
Copy linkTweet thisAlerts:
@NightShift58Feb 17.2007 — No... At the top of your scripts or - better - in your included config.php, if you have one, add:[code=php]<?php
$add_path = $_SERVER['DOCUMENT_ROOT'] . "/design";
set_include_path(get_include_path() . PATH_SEPARATOR . $add_path);
?>[/code]
This will extend the search path for includes to whatever it was plus the new path to the "design" directory. Any include instruction can now be issued without a path. If the file to be included is in the "current" directory, it will grab that one, if not, it'll go through the directories defined in set_include_path() until it finds one.
Copy linkTweet thisAlerts:
@kprocauthorFeb 17.2007 — I'm not quite getting this. I place to script that you provided at the top of the page then

I use include the page like this include(page.php) // I gave this a try and no luck.

thank you for the help
Copy linkTweet thisAlerts:
@NightShift58Feb 17.2007 — Depending on the server, DOCUMENT_ROOT may or may not return a slash at the end. Try it without slash.[code=php]$add_path = $_SERVER['DOCUMENT_ROOT'] . "design"; [/code]
×

Success!

Help @kproc 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 6.13,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

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