PHP include with parameters on IIS server

Status
Not open for further replies.

DewChugr

Photoshop God
Jun 26, 2006
1,977
66
0
48.655139,-119.644032
I have to use an IIS server for a site I'm working on. I need to include a php file with parameters. Everything works fine with the include until I add a parameter to the include then I get errors. Is there a way to get this to work? Right now I am defining the variable before I call the script, but I would rather get it to work the way it does on Apache so I don't have to re-do a bunch of code.

Thanks

This is the include and the errors.

<?php include("includes/dir.php?dirname=documents"); ?>


Warning: main(includes/dir.php?dirname=documents): failed to open stream: No such file or directory in D:\Production\finance.html on line 37

Warning: main(includes/dir.php?dirname=documents): failed to open stream: No such file or directory in D:\Production\finance.html on line 37

Warning: main(): Failed opening 'includes/dir.php?dirname=documents' for inclusion (include_path='.;C:\php4\includes\pear;D:\CUPHD test\;') in D:\Production\finance.html on line 37
 


That just doesn't make any sense what so ever. They are include files, you can't pass parameters to it like that.

Make the code into a function, then just include the file. Call the function and pass the parameters, because when you include a file that files source gets added to the file you included it from.

Ya Digg?
 
Yeah, that makes sense. I was using some code I had in some html pages on an Apache server that didn't parse the html as php so I had to use a include virtual for that php. I guess I wasn't thinking when I moved it to the IIS server, even knowing it was set to parse html as php.

Thanks.
 
Status
Not open for further replies.