|
Posted by Colin Fine on 10/01/06 18:31
One wrote:
> I have a main.php file that calls a php navigation menu.
>
> I want to pass the menu file a parameter to tell it which menu to
> display.
>
> Inside the main.php I have :
> include "/home/ottadca1/public_html/includes/leftnav.php?menuid=dave";
>
> But the error is :
> Warning:
> main(/home/ottadca1/public_html/includes/leftnav.php?menuid=dave)
> [function.main]: failed to open stream: No such file or directory in
> /home/ottadca1/public_html/1menu.php on line 117
>
> Warning: main() [function.include]: Failed opening
> '/home/ottadca1/public_html/includes/leftnav.php?menuid=dave' for
> inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in
> /home/ottadca1/public_html/1menu.php on line 117
>
> However - if use the exact same line without passing a parameter it
> works fine.
> This works : include "/home/ottadca1/public_html/includes/leftnav.php";
>
> I don't understand. I've used this technique in the past.
> Is there some sort of php configuration I am missing ???
>
> THANKS!
>
You seem to be confusing HTTP (or rather CGI) and PHP.
The '?arg=value&arg=value' syntax is part of CGI, and is interpreted by
CGI programs running typically on web browsers. While many CGI
programs are written in PHP, the syntax has nothing to do with PHP: the
program that interprets it might be in Perl, VB, Asp, or other languages.
When you use
include('filename');
you are staying within PHP, telling it to read its some code from
somewhere else.
If you use
include("http://url");
you are telling your PHP programme to send an HTTP request to that
server, and parse the result as PHP code. The server will send back just
what you would get if specified that URL to your browser - which will
not usually be PHP source.
Colin
[Back to original message]
|