PHP File read by HTML file

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
wescrock
Forum Commoner
Posts: 31
Joined: Wed Sep 10, 2008 10:31 am
Location: Fresno, CA

PHP File read by HTML file

Post by wescrock »

Hello,

I have a custom created content management system that controls the content for just one small piece of a web page... the PHP system gets data from a SQL db... I need that php result (DB View) to be processed and displayed in a standard HTML document.

If I set up the apache server to allow SSI's of PHP documents, will it process the PHP? If not, is there a way to export the PHP output into a shtml document?

Thank you,
Wes
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: PHP File read by HTML file

Post by pickle »

You could set up your server to throw all .html documents at the PHP parser. If HTML code is found by the PHP parser outside of the <?php ?> tags, it won't be processed. You could just modify your html files to have <?php include '/some/fancy/file.php'; ?> and it should work.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
wescrock
Forum Commoner
Posts: 31
Joined: Wed Sep 10, 2008 10:31 am
Location: Fresno, CA

Re: PHP File read by HTML file

Post by wescrock »

That is a great suggestion... but my concern is that the site (as a whole) is rather large... would this slow down load times very much?

If not, this may be my best bet... Do you have any idea where documentation for this configuration may be located?

Thank you for your response.
Wes
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: PHP File read by HTML file

Post by pickle »

There will technically be a slowdown as the PHP parser needs to be invoked for every HTML request. However, since most of the files won't have <?php ?> tags in them, the overhead will be minimal.

I'm not exactly sure where to find documentation on this, but basically what you're trying to do is change the extensions (.inc, .php, .php5, etc) that Apache will direct to the PHP parser. I'm pretty sure it's just a single line in the Apache conf file.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply