note 18104 added to function.virtual
| From: | crazyted at crazyted dot com | Date: | Thu, 10 Jan 2002 16:57:52 +0000 |
| Subject: | note 18104 added to function.virtual | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-24628@lists.php.net to get a copy of this message | ||
I have a header that's include()'ed on each of my pages. I then wanted to add a Perl
script to that header file (header.php) via the virtual() command.
Since my header is used by documents in my /www folder along with other folders inside that (and
inside those), and virtual() seems to take only relative paths, I had to write some code to
dynamically get the path to the perl script.
Hope this helps some ppl out:
$cwd = getcwd();
$script_name = "cgi-bin/perl_script.pl";
$count = substr_count($cwd, '/');
$count = $count - 3;
// get rid of extra absolute paths since my directory is /home/user/www
// Add additional path information
for($i = 1; $i <= $count; $i++){
$script_name = "../".$script_name;
}
virtual($script_name);
--
http://www.php.net/manual/en/function.virtual.php
http://master.php.net/manage/user-notes.php?action=edit+18104
http://master.php.net/manage/user-notes.php?action=delete+18104
http://master.php.net/manage/user-notes.php?action=reject+18104