RE: [PHP] Including only I want
Break those lines out into another file... =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Alberto Wagner [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 13, 2002 4:33 AM To: Php General Mailling List Subject: [PHP] Including only I want Is there any way to include only the lines that I want in an other PHP file? something like Include(); like lines number 5,6 and 7. only this ones and not the entire script? -- 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: RE: [PHP] Including only I want
But its exactely what I don't want 13/04/2002 11:11:54, Cal Evans [EMAIL PROTECTED] wrote: Break those lines out into another file... =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Alberto Wagner [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 13, 2002 4:33 AM To: Php General Mailling List Subject: [PHP] Including only I want Is there any way to include only the lines that I want in an other PHP file? something like Include(); like lines number 5,6 and 7. only this ones and not the entire script? -- 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: RE: [PHP] Including only I want
You can't do a partial include. Put some logic into your include file so only the appropriate lines are executed. Or if you are not executing anything but simply reading a file containing data, use fopen()/fgets() and read past the first 5 lines. -Rasmus On Sat, 13 Apr 2002, Alberto Wagner wrote: But its exactely what I don't want 13/04/2002 11:11:54, Cal Evans [EMAIL PROTECTED] wrote: Break those lines out into another file... =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Alberto Wagner [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 13, 2002 4:33 AM To: Php General Mailling List Subject: [PHP] Including only I want Is there any way to include only the lines that I want in an other PHP file? something like Include(); like lines number 5,6 and 7. only this ones and not the entire script? -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Including only I want
Best hope is to include some if statements into the included file, and establish what you want to get out of the file, eg: ? $section = a; include('file.php'); ? --file.php-- ? if($section == a) { // do something } ? -- Or perhaps make the few lines you're after a function, then all you have to do is include your functions library on every page it's needed, and then call the function to do the selected lines/calculations, with a simple ? domyfunction(); ? Regards, Justin French on 13/04/02 7:32 PM, Alberto Wagner ([EMAIL PROTECTED]) wrote: Is there any way to include only the lines that I want in an other PHP file? something like Include(); like lines number 5,6 and 7. only this ones and not the entire script? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: [PHP] Including only I want
I guess it would help if you explained what you are trying to do. the answer to your initial question is no. =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Alberto Wagner [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 13, 2002 5:09 AM To: [EMAIL PROTECTED]; Php General Mailling List Subject: Re: RE: [PHP] Including only I want But its exactely what I don't want 13/04/2002 11:11:54, Cal Evans [EMAIL PROTECTED] wrote: Break those lines out into another file... =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Alberto Wagner [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 13, 2002 4:33 AM To: Php General Mailling List Subject: [PHP] Including only I want Is there any way to include only the lines that I want in an other PHP file? something like Include(); like lines number 5,6 and 7. only this ones and not the entire script? -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: RE: [PHP] Including only I want
I want to make a module system, that open a module and get the first $numberlines of it that will be some configuration variables, the $numberlines will probably be at top of file, at line 1, then I want to script to get the variables and execute them in the kernel.php, allowing me to make modules with configs with only one file 13/04/2002 12:23:50, Cal Evans [EMAIL PROTECTED] wrote: I guess it would help if you explained what you are trying to do. the answer to your initial question is no. =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Alberto Wagner [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 13, 2002 5:09 AM To: [EMAIL PROTECTED]; Php General Mailling List Subject: Re: RE: [PHP] Including only I want But its exactely what I don't want 13/04/2002 11:11:54, Cal Evans [EMAIL PROTECTED] wrote: Break those lines out into another file... =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Alberto Wagner [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 13, 2002 4:33 AM To: Php General Mailling List Subject: [PHP] Including only I want Is there any way to include only the lines that I want in an other PHP file? something like Include(); like lines number 5,6 and 7. only this ones and not the entire script? -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: RE: [PHP] Including only I want
Ok, if you just want to retrieve values form the file and not PHP code, try opening it as a file instead of 'including' it. Read the lines you want, use the values you read in to set variables or branch or whatever. Personally (because I'm a database bigot) I'd stuff them in a table in a database but that's up to you. If you need to read in and execute PHP code, you MIGHT could get away with reading them in as described above and then using eval() to do execute them one at a time...but I'd steer clear of this. =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Alberto Wagner [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 13, 2002 8:13 AM To: [EMAIL PROTECTED]; Php General Mailling List Subject: Re: RE: RE: [PHP] Including only I want I want to make a module system, that open a module and get the first $numberlines of it that will be some configuration variables, the $numberlines will probably be at top of file, at line 1, then I want to script to get the variables and execute them in the kernel.php, allowing me to make modules with configs with only one file 13/04/2002 12:23:50, Cal Evans [EMAIL PROTECTED] wrote: I guess it would help if you explained what you are trying to do. the answer to your initial question is no. =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Alberto Wagner [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 13, 2002 5:09 AM To: [EMAIL PROTECTED]; Php General Mailling List Subject: Re: RE: [PHP] Including only I want But its exactely what I don't want 13/04/2002 11:11:54, Cal Evans [EMAIL PROTECTED] wrote: Break those lines out into another file... =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Alberto Wagner [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 13, 2002 4:33 AM To: Php General Mailling List Subject: [PHP] Including only I want Is there any way to include only the lines that I want in an other PHP file? something like Include(); like lines number 5,6 and 7. only this ones and not the entire script? -- 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 -- 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] Including only I want
You can call for this include inside a function and then Return inside included file. Not sure if it's suitable for you, inside functions there are quite a few extra things to do like Globals etc. Or, you could fopen(), read the needed lines, assign to a variable and eval() it. Quite a silly way though. Sincerely, Maxim Maletsky Founder, Chief Developer [EMAIL PROTECTED] PHPBeginner.com (Where PHP Begins) www.phpbeginner.com -Original Message- From: Justin French [mailto:[EMAIL PROTECTED]] Sent: Saturday, April 13, 2002 5:16 PM To: Alberto Wagner; Php General Mailling List Subject: Re: [PHP] Including only I want Best hope is to include some if statements into the included file, and establish what you want to get out of the file, eg: ? $section = a; include('file.php'); ? --file.php-- ? if($section == a) { // do something } ? -- Or perhaps make the few lines you're after a function, then all you have to do is include your functions library on every page it's needed, and then call the function to do the selected lines/calculations, with a simple ? domyfunction(); ? Regards, Justin French on 13/04/02 7:32 PM, Alberto Wagner ([EMAIL PROTECTED]) wrote: Is there any way to include only the lines that I want in an other PHP file? something like Include(); like lines number 5,6 and 7. only this ones and not the entire script? -- 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