| |||||||||||
| |||||||||||
Making every page on a site into PHP Posted by enquirer (enquirer), 6 September 2002 "Can I set up my web site so that every single web page (even the home page) contains bits of program code?"Posted by John_Moylan (John_Moylan), 6 September 2002 Yep!As long you use extention thats recognised by the PHP preprocessor on your system. (.php, .php3 etc) The fact is it will parse the PHP page and just spit out the HTML, there will be a marginal performance hit on the request though, but the preprocessors fast so it's not a major issue. example: <?php <html> <head> <title>Doh!</title> </head> <body> Nothing in the page for PHP to see </body> </html> ?> Inform me if I'm wrong people, but I'm sure thats right Posted by admin (Graham Ellis), 6 September 2002 Even the <?php and ?> aren't required, since PHP starts up in what I describe as "HTML mode" ...And here's another "trick" for you. If your web admin allows you to have .htaccess files, then you can place such a file in any directory on your web site and add the line: AddType application/x-httpd-php .html then any file ending in .html will be taken as a PHP file too. By the way, the .htaccess file is recursive, so if you put one in your document root .... Posted by admin (Graham Ellis), 6 September 2002 P.S. If you add something likeErrorDocument 404 /net/report.php4?err=404 to your .htaccess file, you can replace your "error 404" page with a piece of PHP; we use this to find out where broken links are coming in from via the $HTTP_REFERER variable ... that way we can easily track down the breakages to their source! This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |