/    Sign up×
Community /Pin to ProfileBookmark

loading php files into php files problem

I’m having a hard time getting one php file to include another php file

example:

index.php

<html>
<head>
<body>

<?php include(“content.php”); ?>

</body>
</html>

the path to the file is fine, I know this because the include works with html files in the same directory, but just not the php file *grumble grumble* Any advice oh wide world of fellow webnuts?

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@pyroFeb 24.2005 — The code is fine... Are you getting any erros?
Copy linkTweet thisAlerts:
@DARTHTAMPONFeb 24.2005 — try this
[code=php]
<?php
include 'content.php';
?>
[/code]
Copy linkTweet thisAlerts:
@NogDogFeb 24.2005 — Try replacing include() with require() and see if that throws an error. If it doesn't, then I suspect we may need to see what's in the included file to figure out why it's not doing what you expect it to do.
Copy linkTweet thisAlerts:
@T-WagauthorFeb 25.2005 — Here's the error I get with the real php file including the other real php file (not the above example):

Warning: Failed opening '../../../source/main_layout/php/basic_rightsideb.html' for inclusion (include_path='.:/usr/lib/php') in /Library/WebServer/Documents/SouthShoreNow/source/main_layout/php/rightsideb.php on line 3

The page is there except the element I want to include.

I tried putting the single quotes instead of double quotes and I got the same error.

See, what I have is an index.php file in the root folder of the site, of course. and I'm trying to linclude a php file that has an include to an html file into this index file. And it's not working. However, other pages in the site can do this no problem. It's just this bloody index file. The error above isn't refering to the index file's include, it's an error refering to the include in the second file that is being included into the index.

...and now that we're all confused....

here's the structure of the relevent site files:

/index.php

which includes:

/source/main_layout/php/rightsideb.php

which contains it's own content (images, links, etc.) but also includes:

/source/main_layout/php/basic_rightsideb.html

and the error pertains to the basic_rightsideb.html include in the rightsideb.php file when I try to include it into the index.

I hope this all makes sense :S
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYFeb 25.2005 — try uploading this in your root dir

does it outputs:

Im index

Im level1

Im level2

?

[upl-file uuid=860e9c8d-5b45-4795-9be0-768d6feccb24 size=756B]structure.zip[/upl-file]
×

Success!

Help @T-Wag 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.18,
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,
)...