/    Sign up×
Community /Pin to ProfileBookmark

Trouble to Find img resource within a main page using include()

[B]Hi Guys,

I am new to php , i have a problem on the following scenario.

I have a root directory called “TestProg” inside it i have a file called “mainpage.php” and a directory called “Tutorial” , within the “Tutorial” directory i have a file called “content.php” and a directory called “img” within it an images file called “myPic.jpg”.
[/B]

[COLOR=”Red”]please see the attachment pictures for the directory structure.[/COLOR]

[B]The “mainpage.php” is the template file , it calls the content of the content.php with an include()… The content.php has a text and an img tag calling the image in mypic.jpg in the img directory.

When opening the “mainpage.php” , the content.php content is loaded properly by the exception of the image. when checking the html source code the path is incorrect (show img/mypic.jpg instead of Tutorial/ img/mypic.jpg)…[/B]

here is the content of both files
+++++++++++++++++++++++

// mainpages.php (under “TestProg” directory)


***********

<html>
<body>
<h1> This is the main index pages <h1/>
<br />

<?php
include(‘tutorial/content.php’);
?>

</body>
</html>

========================================

// content.php (under “testProg/Tutorial” directory)


*********

<p>
this is the image paragraph
<img src=”img/chebeya.jpg”>
</p>

====================================

can someone help to solve the path problem.

Thanks in advance ?

[upl-file uuid=9642fb65-8e8a-4d61-9ac3-0c3ac663c2e5 size=9kB]chartp.jpg[/upl-file]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@mikekamsauthorOct 10.2010 — I have managed to make it work by changing the following in the content.php file

<img src="tutorial/img/chebeya.jpg">

instead of

<img src="img/chebeya.jpg">

as per my previous post.
×

Success!

Help @mikekams 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.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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