/    Sign up×
Community /Pin to ProfileBookmark

PHP & page links

New to PHP & trying to create a site strictly with PHP. I’m probably missing something fundamental here (frontal lobe?), but don’t know what.

I have a page titled index.php. It uses PHP includes:
<body>
<? include(‘header.php’); ?>
<? include(‘nav.php’); ?>
<? include(‘ad.php’); ?>
<? include(‘homepage.php’); ?>
</body>
Homepage.php has the content I want to display. So far, so good. Everything displays properly.

Here’s my problem. Homepage.php uses a simple html link to another page: <a href=”submissions.php”>contribute to the site</a>. That page includes the same <? include ?> statements as index.php, but what displays is only the content of submissions.php. No header. No navigation. No right-hand column. No joy. ?

I’m testing this locally, on my laptop, and the files have not been uploaded to the server, in case that has a bearing on things. Ideas?

to post a comment
PHP

11 Comments(s)

Copy linkTweet thisAlerts:
@BonnerFeb 13.2004 — The same happened to me, I did not have much time to look into this so I turned to frames for getting content from another page. There will probably be a better way than frames but a quick fix for now would be to put a frame in the PHP page already being imported which includes a new PHP page that imports PHP.

Like I said just a quick fix, I would not recommend using frames like this. I also have a dislike for frames too so this is my main reason not to do it like this.
Copy linkTweet thisAlerts:
@SamFeb 13.2004 — so, just to get this straight, your submissions.php looks like this:
[code=php]
<body>
<? include('header.php'); ?>
<? include('nav.php'); ?>
<? include('ad.php'); ?>
//submissions.php content
</body>
[/code]

if not, this is how it should look, of course with valid html before and after the body tags
Copy linkTweet thisAlerts:
@BonnerFeb 13.2004 — Basically the guy means:

index.php:
[code=php]<?php
include("foo.php");
#other stuff
?>[/code]


foo.php:
[code=php]<?php
include("lipsum.php");
#other stuff
?>[/code]


Output = nothingness
Copy linkTweet thisAlerts:
@Aronya1authorFeb 13.2004 — [i]Originally posted by samij586 [/i]

[B]so, just to get this straight, your submissions.php looks like this:

[code=php]
<body>
<? include('header.php'); ?>
<? include('nav.php'); ?>
<? include('ad.php'); ?>
//submissions.php content
</body>
[/code]

if not, this is how it should look, of course with valid html before and after the body tags [/B][/QUOTE]


Exactly right.
Copy linkTweet thisAlerts:
@SamFeb 13.2004 — hmmm... kinda a noob, so i'm not sure if this makes a diference, but have you tried:
[code=php]<?php include('header.php'); ?>
<?php include('nav.php'); ?>
<?php include('ad.php'); ?> [/code]
Copy linkTweet thisAlerts:
@Aronya1authorFeb 13.2004 — Just tried it, but no change. I'm hoping the problem is just that I'm not doing real-world testing & it will fix itself when I can upload things to the server. Will find that out in a few hours.
Copy linkTweet thisAlerts:
@BonnerFeb 13.2004 — Sorry to disapoint you but uploading will not fix this. I had the same problem.
Copy linkTweet thisAlerts:
@Aronya1authorFeb 13.2004 — Where's Pyro when I need him?
Copy linkTweet thisAlerts:
@BonnerFeb 13.2004 — He was very busy when I got in touch with him through e-mail earlier. I would look into it now but I am having problems with Internet Explorer and PNG alpha channels. (I know about the PNG support with IE so please do not comment on this, after all it is in the wrong forum too.)
Copy linkTweet thisAlerts:
@Aronya1authorFeb 14.2004 — Won't know for sure until later tonight, but I'm fairly well convinced that it's an issue not testing on a real PHP server. If I open index.php with a browser, I get nothing at all. Index.php has no content of its own; only <includes> of other .php files. I'll report findings when/if I figure it out.
Copy linkTweet thisAlerts:
@Aronya1authorFeb 14.2004 — Problem solved. Just uploaded files to the server & the issue went away.
×

Success!

Help @Aronya1 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,
)...