/    Sign up×
Community /Pin to ProfileBookmark

php and doctype functionability

So, this is pertaining to the same set of code I’ve been drilling you guys in this forum about. Basically I have a protected section that users can log into and instead of writing the code for the pages in every php file, I figured I could have one template and just code the info that is specific to that part of the section into each php file. It sounded good to me and worked well in my perl version of the same sort of thing I made (except I think I’m gonna have to split up the template because I still can’t seem to get the preg_match() or strpos() functions to work like I want them to).

Anyway, I open the template with fopen and print it out like so:

[CODE]
while(!feof($login))
{
echo fgetc($login);
}
[/CODE]

But, when I do this, even though it prints out the doctype

[QUOTE]

<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN”
http://www.w3.org/TR/html4/strict.dtd“>

[/QUOTE]

When I view the page in a browser it looks as if the doctype isn’t there. Is there something I’m doing wrong here? Should I be printing out a header before the template?

I tried this:

[CODE]
header(‘Content-type: text/html’);
[/CODE]

But that didn’t work.

Anybody know what the problem might be?
Thanks,
Douglas

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@DJRobThaManauthorFeb 06.2006 — hmmm.... This is interesting.

If instead of opening the file and printing it out I so this:

[CODE]
<?php require("file.html") ?>
[/CODE]


It works perfectly.

Strange I think, but at lleast I got it to work.
Copy linkTweet thisAlerts:
@chazzyFeb 06.2006 — hmm maybe if you posted more of your code we could see what's going on.
×

Success!

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