|
06-17-2004, 04:44 PM | #1 |
Green Mole
Join Date: Jun 2004
Posts: 1
|
Apache includes in a template
Here is a quick mod that lets me put server-side includes in a template file -- it emulates the Apache <!--#include virtual= ... --> directives in server-parsed HTML files.
For example, In a template file I can put: <phpdig:inclucde virtual="/foo.html" /> to include a file containing a block of html or <phpdig:inclucde virtual="/cgi-bin/bar.pl" /> to include the output of a cgi program, in this case the output of a perl script named bar.pl. I haven't tried it, but I assume that you could include php output the same way. Here is the mod to libs\function_phpdig_form.php that makes it work: Change the lines: PHP Code:
PHP Code:
This method only works on sites where php's virtual() function works -- that means only on Apache servers, and they must be running php as a plugin, not as a cgi program. This mod has worked for me on: Win/XP + Apache 2.0.45 + Php 4.3.7 FreeBSD + Apache 1.3.27 + Php 4.3.4 If you don't provide a rooted path to the included file, its path will be relative to $relative_script_path. My implementation has some restrictions that could probably be fixed by someone with a better understanding of php and the PhpDig code: The <phpdig:inclucde ...> tag must be at the start of line, nothing but blanks should precede it. It can't go inside a <phpdig:results> loop. Thanks to everyone involved with PhpDig; it looks like it will be a great addition to my website. I'd appreciate any feedback or corrections for the mod. Regards, Steve Green Last edited by sgreen; 06-17-2004 at 05:20 PM. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
apache:apache on connect.php | lucite | Troubleshooting | 0 | 01-27-2007 09:02 AM |
php includes template info | 5wayshost | Coding & Tutorials | 0 | 12-31-2006 10:59 PM |
Themes and PHP Includes | Arctic | Troubleshooting | 3 | 05-07-2005 09:21 PM |
Parse error with includes | cherie | Troubleshooting | 1 | 12-14-2004 01:34 PM |
PHP includes in Template? | jirving | How-to Forum | 1 | 09-29-2003 03:37 PM |