-
17-12-03 #1
25 chars.? Need more spac
- Join Date
- Aug 2003
- Location
- here
- Posts
- 132
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Including a PHP include within a PHP include ??
Currently I parse a perl database using a php include in the usual fashion...
<? include ('http://www.url.com/database.pl?qry=QUERY'); ?>
I also have a script day.php which will (strangely enough) display the day ....
What I would like to be able to do is to create an include simlar to above, but replacing QUERY with the output of day.php - however even using absolute paths I still can't get it to work ... and may just scream until I'm sick (and I can...)
Would someone please enlighten me as to how I should be doing this??
Cheers!
Duncan
-
17-12-03 #2
Registered User
- Join Date
- Aug 2003
- Posts
- 2,453
- Thanks
- 0
- Thanked 0 Times in 0 Posts
If your day.php echos the day to the browser then that is what it will still do when included. What you need to do is edit day.php so instead of echoing the result it saves it to a variable (if it isn't already in one) then use that variable in the second include.
Assuming day.php assigns the day to $day then your code would look like
<?
include ('day.php');
include ("http://www.url.com/database.pl?qry=$day");
?>
Note: the second include must use " rather than ' to evaluate $day, also included php code is only parsed if the included file is local to the calling script i.e. accessed via a local path rather than a remote (http://) one.
Hope this helps.
-
17-12-03 #3
25 chars.? Need more spac
- Join Date
- Aug 2003
- Location
- here
- Posts
- 132
- Thanks
- 0
- Thanked 0 Times in 0 Posts
D'oh! Call me Mr Dim and beat me about with a wet haddock..Originally posted by Rich
If your day.php echos the day to the browser then that is what it will still do when included. What you need to do is edit day.php so instead of echoing the result it saves it to a variable (if it isn't already in one) then use that variable in the second include.
Cheers Rich, I make no excuses for my temporary lack of any common sense...
Duncan
-
17-12-03 #4
Super Member
- Join Date
- Sep 2003
- Location
- Manchester
- Posts
- 1,065
- Thanks
- 2
- Thanked 0 Times in 0 Posts
madstock,
sorry, not got the time today to think this through properly but take a look at the eval function. that may help as well.
john
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Anyone anygood with xml, php, mysql and Affiliate Window
By AnnonnyMouse in forum Affiliate Marketing LoungeReplies: 1Last Post: 23-09-04, 12:00 PM -
Php Include
By scifind in forum ProgrammingReplies: 5Last Post: 14-08-03, 06:01 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks