[PHP] include opens source, but it shouldn't
why does include always opens my included file although it is defined as a variable Example: $file=include(/myfile/myfile.txt/); shouldn't it only be opend by typing echo $file; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include opens source, but it shouldn't
[snip] why does include always opens my included file although it is defined as a variable Example: $file=include(/myfile/myfile.txt/); shouldn't it only be opend by typing echo $file; [/snip] The include() opens the file to place it in the variable, in other words include means READ INTO. Therfore $file=READ INTO THIS FILE(/myfile/myfile.txt/); HTH! Jay Im really easy to get along with, once you people learn to worship me *** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort Conference Center * * New Braunfels, Texas* * San Antonio Area PHP Developers Group * * Interested? Contact [EMAIL PROTECTED] * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include opens source, but it shouldn't
Can't you use a fopen('$file','r+'); or some like this instead? Otherwise, I don't use vars to store includes in. I always use constructs like this: include('/path-to-file/file-name.inc.php'); But what happens when you put a file via fopen() driektive into an array? - Will it be parsed later on? Schura - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: 'Harry.de' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, August 15, 2002 6:25 PM Subject: RE: [PHP] include opens source, but it shouldn't [snip] why does include always opens my included file although it is defined as a variable Example: $file=include(/myfile/myfile.txt/); shouldn't it only be opend by typing echo $file; [/snip] The include() opens the file to place it in the variable, in other words include means READ INTO. Therfore $file=READ INTO THIS FILE(/myfile/myfile.txt/); HTH! Jay I'm really easy to get along with, once you people learn to worship me *** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort Conference Center * * New Braunfels, Texas* * San Antonio Area PHP Developers Group * * Interested? Contact [EMAIL PROTECTED] * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include opens source, but it shouldn't
It will probably behave the same way include does, which is correct behavior. $file=include(whatever) is telling php to store the result from include in the $file variable, not storing a command in it. You could do $file='include()', and then you would wind up with a variable with whatever text you assigned to it. This is covered in the manual, Jason -Original Message- From: Sascha Braun [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 15, 2002 10:31 AM To: PHP Mailingliste; Jay Blanchard Subject: Re: [PHP] include opens source, but it shouldn't Can't you use a fopen('$file','r+'); or some like this instead? Otherwise, I don't use vars to store includes in. I always use constructs like this: include('/path-to-file/file-name.inc.php'); But what happens when you put a file via fopen() driektive into an array? - Will it be parsed later on? Schura - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: 'Harry.de' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, August 15, 2002 6:25 PM Subject: RE: [PHP] include opens source, but it shouldn't [snip] why does include always opens my included file although it is defined as a variable Example: $file=include(/myfile/myfile.txt/); shouldn't it only be opend by typing echo $file; [/snip] The include() opens the file to place it in the variable, in other words include means READ INTO. Therfore $file=READ INTO THIS FILE(/myfile/myfile.txt/); HTH! Jay I'm really easy to get along with, once you people learn to worship me *** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort Conference Center * * New Braunfels, Texas* * San Antonio Area PHP Developers Group * * Interested? Contact [EMAIL PROTECTED] * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include opens source, but it shouldn't
[snip] What is in the file? Do you have a print($file) or echo somewhere? Does the included file have print() or echo() in it? No, in the file is only html [/snip] There you go ... HTML will be parsed by the browser and displayed. So it is doing exactly what it is supposed to do. HTH! Jay Im really easy to get along with, once you people learn to worship me *** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort Conference Center * * New Braunfels, Texas* * San Antonio Area PHP Developers Group * * Interested? Contact [EMAIL PROTECTED] * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include opens source, but it shouldn't
[snip] [snip] What is in the file? Do you have a print($file) or echo somewhere? Does the included file have print() or echo() in it? No, in the file is only html [/snip] There you go ... HTML will be parsed by the browser and displayed. So it is doing exactly what it is supposed to do. [/snip] Are you wanting to place the file into the variable so that you can echo it out later? That is an extra step that you do not need. Just place the include() function where you want it to appear. HTH! Jay *** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort Conference Center * * New Braunfels, Texas* * San Antonio Area PHP Developers Group * * Interested? Contact [EMAIL PROTECTED] * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include opens source, but it shouldn't
[snip] Are you wanting to place the file into the variable so that you can echo it out later? That is an extra step that you do not need. Just place the include() function where you want it to appear. But what do if i want echo it out later - That's exactly what i want do [/snip] You mean more than once? Then do the include again... ?php some stuff here more stuff include(/myfile/myfile.txt/); more stuff other stuff this stuff include(/myfile/myfile.txt/); that stuff the other stuff ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include opens source, but it shouldn't
What happens to a javascript, which only is able to hold code snippets in one lined vars (if u understand what i mean); But my Content, comming from my Database (HTML) is longer than a javascript line. And I put it there for in an php variable? It will be the same, or? Schura (O;? - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: 'Jay Blanchard' [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, August 15, 2002 7:03 PM Subject: RE: [PHP] include opens source, but it shouldn't [snip] [snip] What is in the file? Do you have a print($file) or echo somewhere? Does the included file have print() or echo() in it? No, in the file is only html [/snip] There you go ... HTML will be parsed by the browser and displayed. So it is doing exactly what it is supposed to do. [/snip] Are you wanting to place the file into the variable so that you can echo it out later? That is an extra step that you do not need. Just place the include() function where you want it to appear. HTH! Jay *** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort Conference Center * * New Braunfels, Texas* * San Antonio Area PHP Developers Group * * Interested? Contact [EMAIL PROTECTED] * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include opens source, but it shouldn't
[snip] Only on demand. I'd like to define the variable without showing the file $var=include(); do something else echo $var; [/snip] Since the included file outputs headers you cannot do what it is you wish to do AFAIK. When I do includes, and having looked at other's code I can say that I am in good company, where HTML is involved and I need to use it again I just call another include() function. I do this for navigation items, footers, headers, and other odd items. Jay Im just working here till a good fast-food job opens up *** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort Conference Center * * New Braunfels, Texas* * San Antonio Area PHP Developers Group * * Interested? Contact [EMAIL PROTECTED] * *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include opens source, but it shouldn't
From: Jay Blanchard [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 15, 2002 1:19 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] include opens source, but it shouldn't [snip] Only on demand. I'd like to define the variable without showing the file $var=include(); do something else echo $var; [/snip] Harold, is this what you're looking for: $var = readf('file.html'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php