tags:

views:

17

answers:

1

I really have read the other articles that cover this subject. But I seem to be in a slightly different position. I'm not using modrewrite (other articles).

I would like to 'include' a webpage its a 'Joomla php' generated page inside a php script. I'd hoped to make additions on the 'fly' without altering the original script. So I was going to 'precomplete' elements of the page by parasing the page once it was included I hadent wanted to hack the original script. To the point I can't include the file and its not because the path is wrong -

so include ("/home/public_html/index.php"); this would work include ("/home/public_html/index.php?option=com_k2&view=item&task=add"); this would not!

I've tried a variety of alternates, in phrasing, I can't use the direct route "http:etc..." since its a current php version so must be a reference to the same server. I tried relative, these work without the ?option=com_k2&view=item&task=add

It may be the simple answer that 'options' or variables can be passed. Or that the include can't be used to 'wait' for a page to be generated - i.e. it will only return the html.

I'm not the biggest of coders but I've done alot more than this and I thought this was so basic.

+2  A: 

this would work include ("/home/public_html/index.php?option=com_k2&view=item&task=add"); this would not!

And it never will: You are mixing a filesystem path with GET parameters, which can be passed only through the web server (utilizing a http:// call... But that, in turn, won't run the PHP code the way you want.)

You could set the variables beforehand:

 $option = "com_k2";
 $view =   "item";
 $task =   "add";

include the file the normal way:

 include ("/home/public_html/index.php"); 

this is assuming that you have access to the file, and can change the script to expect variables instead of GET parameters.

Pekka
Of course you CAN include by URL, but this is of course very VERY bad design because of security issues. I only mention it because Andrew may find this out on his own, and I want to be clear that it is a very very bad idea.
Brad
Thankyou. I really had not wanted to alter the file, just add to it! but it looks like it may not be.. thankyou - and Brad thumbs up for the security - I've read enough about this topic to discover the bad side of turning off certain php features! cheers... Andy.
Andrew