Re: [PHP] include question

2009-03-07 Thread Nathan Rixham

Daniel Brown wrote:

On Fri, Mar 6, 2009 at 08:53, Stuart  wrote:

   1.) We use regular open tags to be compatible with all stock
PHP configurations.
   2.) We echo out the response from dirname() so that it's
output to the HTML source.
   3.) We use dirname() twice, so it gives the dirname() of the
dirname(), rather than '..'.
   4.) There are double underscores around FILE.  The same is
true with LINE, FUNCTION, etc.

5.) dirname() gives you the full path on disk, not the URL. Usually you can
just remove the document root path to get the URL. This could be in
$_SERVER['DOCUMENT_ROOT'] but you can't rely on that between servers or when
the config changes.


6.) When used in conjunction with realpath()[1], it will
resolve the absolute local pathname.

^1: http://php.net/realpath



that's the way i do it, for example

require_once realpath( dirname(__FILE__) . '/lib/LibAllTests.php' );

also I often use set_include_path to ensure everything works throughout, 
it's a lot simpler for require/includes


set_include_path( get_include_path() . PATH_SEPARATOR . realpath( 
dirname(__FILE__) . DIRECTORY_SEPARATOR ) );


for example.. then all subsequent requires will be:

require_once 'Folder/file.php';

regards

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] include question

2009-03-06 Thread PJ
Daniel Brown wrote:
> On Fri, Mar 6, 2009 at 08:53, Stuart  wrote:
>   
>>>1.) We use regular open tags to be compatible with all stock
>>> PHP configurations.
>>>2.) We echo out the response from dirname() so that it's
>>> output to the HTML source.
>>>3.) We use dirname() twice, so it gives the dirname() of the
>>> dirname(), rather than '..'.
>>>4.) There are double underscores around FILE.  The same is
>>> true with LINE, FUNCTION, etc.
>>>   
>> 5.) dirname() gives you the full path on disk, not the URL. Usually you can
>> just remove the document root path to get the URL. This could be in
>> $_SERVER['DOCUMENT_ROOT'] but you can't rely on that between servers or when
>> the config changes.
>> 
>
> 6.) When used in conjunction with realpath()[1], it will
> resolve the absolute local pathname.
>
> ^1: http://php.net/realpath
>
>   
Sorry, guys, but none of this works...
I get the document root which is wonderful but it misses the vhost root
completely.
So what I get both with realpath and $SERVER['DOCUMENT_ROOT']is
/usr/local/www/apache22/data/images/file.gif or
/usr/local/www/apache22/data/../images/file.gif
and that, of course misses the main directory for this site which is
ptahhotep

In /ptahhotep/file.php - the path for the image.gif is images/image.gif
In /ptahhotep/admin/another_file.php/ the path  for the image.gif is
../images/image.gif

But as I try different variations, I finally see that adding the root
directory name for the site does the trick.

Have I discovered something new here? :-)


-- 
unheralded genius: "A clean desk is the sign of a dull mind. "
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] include question

2009-03-06 Thread Daniel Brown
On Fri, Mar 6, 2009 at 08:53, Stuart  wrote:
>>
>>        1.) We use regular open tags to be compatible with all stock
>> PHP configurations.
>>        2.) We echo out the response from dirname() so that it's
>> output to the HTML source.
>>        3.) We use dirname() twice, so it gives the dirname() of the
>> dirname(), rather than '..'.
>>        4.) There are double underscores around FILE.  The same is
>> true with LINE, FUNCTION, etc.
>
> 5.) dirname() gives you the full path on disk, not the URL. Usually you can
> just remove the document root path to get the URL. This could be in
> $_SERVER['DOCUMENT_ROOT'] but you can't rely on that between servers or when
> the config changes.

6.) When used in conjunction with realpath()[1], it will
resolve the absolute local pathname.

^1: http://php.net/realpath

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] include question

2009-03-06 Thread Stuart
2009/3/6 Daniel Brown 

> On Fri, Mar 6, 2009 at 08:37, PJ  wrote:
> > good morning all,
> >
> > How can I include src and href in include files that will refer the
> > right paths from files in different hierarchies(directory tree levels)?
> > Example:
> > include dirname(_FILE_)."/../lib/header1.php"; ?
> >
> > This does not work:
> > snippetysnip...
> >  > type="text/css">
> > 
> > Nor does this: (NOTE THE DIFFERENCES " AND ' IN THE SRC AND HREF)
> > 
> > > Perhaps it's not possible?
>
> It is when it's parsed by PHP.  You're just putting it through as
> straight HTML, which - even though it may have a .php extension -
> won't work as you might be expecting.
>
>Instead, you have to instruct the parsing engine where and when to
> interpret, compile, and execute the code, like so:
>
> 
>
>In the above snippet, notice a few very important things:
>
>1.) We use regular open tags to be compatible with all stock
> PHP configurations.
>2.) We echo out the response from dirname() so that it's
> output to the HTML source.
>3.) We use dirname() twice, so it gives the dirname() of the
> dirname(), rather than '..'.
>4.) There are double underscores around FILE.  The same is
> true with LINE, FUNCTION, etc.


5.) dirname() gives you the full path on disk, not the URL. Usually you can
just remove the document root path to get the URL. This could be in
$_SERVER['DOCUMENT_ROOT'] but you can't rely on that between servers or when
the config changes.
-Stuart

-- 
http://stut.net/


Re: [PHP] include question

2009-03-06 Thread Daniel Brown
On Fri, Mar 6, 2009 at 08:37, PJ  wrote:
> good morning all,
>
> How can I include src and href in include files that will refer the
> right paths from files in different hierarchies(directory tree levels)?
> Example:
> include dirname(_FILE_)."/../lib/header1.php"; ?
>
> This does not work:
> snippetysnip...
>  type="text/css">
> 
> Nor does this: (NOTE THE DIFFERENCES " AND ' IN THE SRC AND HREF)
> 
>     Perhaps it's not possible?

It is when it's parsed by PHP.  You're just putting it through as
straight HTML, which - even though it may have a .php extension -
won't work as you might be expecting.

Instead, you have to instruct the parsing engine where and when to
interpret, compile, and execute the code, like so:



In the above snippet, notice a few very important things:

1.) We use regular open tags to be compatible with all stock
PHP configurations.
2.) We echo out the response from dirname() so that it's
output to the HTML source.
3.) We use dirname() twice, so it gives the dirname() of the
dirname(), rather than '..'.
4.) There are double underscores around FILE.  The same is
true with LINE, FUNCTION, etc.



-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] include() question

2006-05-09 Thread Richard Lynch
On Mon, May 8, 2006 1:42 pm, PHP wrote:
> Normally I would, except that file does a lot of work, and it was too
> much
> to have on the same server. That is why I was including it remotely.

Unless the remote server is HUMUNGOUS compared to the original server,
or it just has nothing else to do but run this one script, methinks
you aren't fixing anything useful...

Which is evidenced by the fact that it's timing out.

Maybe you need to try a different tack.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] include() question

2006-05-08 Thread Wolf
Sounds like a good reason to lobby for new hardware!!  :)

Also sounds like why it might be timing out for you as well.  Depending
on how "core" that file is to your business and online presence (and
they both matter equally), you might want to look at investing in new
hardware for the server(s) so that the load can be distributed and such.

>From everything I have read, this sounds more like your solution then
not getting that page's information.

Just my $.02

Wolf

PHP wrote:
> Normally I would, except that file does a lot of work, and it was too
> much to have on the same server. That is why I was including it remotely.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] include() question

2006-05-08 Thread PHP
Normally I would, except that file does a lot of work, and it was too much 
to have on the same server. That is why I was including it remotely.



- Original Message - 
From: "Wolf" <[EMAIL PROTECTED]>

To: "PHP" <[EMAIL PROTECTED]>
Cc: "php" 
Sent: Monday, May 08, 2006 11:21 AM
Subject: Re: [PHP] include() question



Bad programmer!  No Donut!

Just out of curiosity, why not just rsync the file over or copy it
straight to the server you are running?  That way you don't have to
worry about it going missing. No telling when a server HD might go t*ts
up and you'll be left holding the bag(s).

Wolf

PHP wrote:

Hi,
I am including a page from another server: (include("http://";));








--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/333 - Release Date: 5/5/2006

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] include() question

2006-05-08 Thread Wolf
Bad programmer!  No Donut!

Just out of curiosity, why not just rsync the file over or copy it
straight to the server you are running?  That way you don't have to
worry about it going missing. No telling when a server HD might go t*ts
up and you'll be left holding the bag(s).

Wolf

PHP wrote:
> Hi,
> I am including a page from another server: (include("http://";));


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] include() question

2006-05-08 Thread PHP

Hey, what do you know, readfile() times out too.


- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>

To: "PHP" <[EMAIL PROTECTED]>; "php" 
Sent: Monday, May 08, 2006 11:05 AM
Subject: RE: [PHP] include() question



[snip]
I am including a page from another server: (include("http://";));

Works fine, but if for some reason that server is not responding, the page 
that is calling it also never returns, so the user ends up with a time 
out.


Is there something I can set that will not force the calling server to 
wait indefinetely for the remote server to respond, and just continue on?

[/snip]

This is;

a. A Bad Thing [tm]

2. RTFM http://www.php.net/include "Remote file may be processed at the 
remote server (depending on the file extension and the fact if the remote 
server runs PHP or not) but it still has to produce a valid PHP script 
because it will be processed at the local server. If the file from the 
remote server should be processed there and outputted only, readfile() is 
much better function to use. Otherwise, special care should be taken to 
secure the remote script to produce a valid and desired code."







--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/333 - Release Date: 5/5/2006

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] include() question

2006-05-08 Thread PHP

Yeah...

The page does produce valid code. However, the manual didn't say anything 
about timing out.



- Original Message - 
From: "Jay Blanchard" <[EMAIL PROTECTED]>

To: "PHP" <[EMAIL PROTECTED]>; "php" 
Sent: Monday, May 08, 2006 11:05 AM
Subject: RE: [PHP] include() question



[snip]
I am including a page from another server: (include("http://";));

Works fine, but if for some reason that server is not responding, the page 
that is calling it also never returns, so the user ends up with a time 
out.


Is there something I can set that will not force the calling server to 
wait indefinetely for the remote server to respond, and just continue on?

[/snip]

This is;

a. A Bad Thing [tm]

2. RTFM http://www.php.net/include "Remote file may be processed at the 
remote server (depending on the file extension and the fact if the remote 
server runs PHP or not) but it still has to produce a valid PHP script 
because it will be processed at the local server. If the file from the 
remote server should be processed there and outputted only, readfile() is 
much better function to use. Otherwise, special care should be taken to 
secure the remote script to produce a valid and desired code."







--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/333 - Release Date: 5/5/2006

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] include() question

2006-05-08 Thread Richard Lynch
On Mon, May 8, 2006 12:55 pm, PHP wrote:
> I am including a page from another server: (include("http://";));
>
> Works fine, but if for some reason that server is not responding, the
> page that is calling it also never returns, so the user ends up with a
> time out.
>
> Is there something I can set that will not force the calling server to
> wait indefinetely for the remote server to respond, and just continue
> on?

Try this:
$old = ini_set('default_socket_timeout', 0); //wait forever
include "http://...";;
ini_set('default_socket_timeout', $old);

No promise it will work.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] include() question

2006-05-08 Thread Jay Blanchard
[snip]
I am including a page from another server: (include("http://";));
 
Works fine, but if for some reason that server is not responding, the page that 
is calling it also never returns, so the user ends up with a time out.
 
Is there something I can set that will not force the calling server to wait 
indefinetely for the remote server to respond, and just continue on?
[/snip]

This is;

a. A Bad Thing [tm]

2. RTFM http://www.php.net/include "Remote file may be processed at the remote 
server (depending on the file extension and the fact if the remote server runs 
PHP or not) but it still has to produce a valid PHP script because it will be 
processed at the local server. If the file from the remote server should be 
processed there and outputted only, readfile() is much better function to use. 
Otherwise, special care should be taken to secure the remote script to produce 
a valid and desired code."

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] include question

2004-06-28 Thread Aaron Axelsen
Thanks, worked wonders. 


--
Aaron Axelsen
Email: [EMAIL PROTECTED]

-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 21, 2004 10:40 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] include question

On Mon, 21 Jun 2004 10:31:42 -0500 (CDT), Aaron Axelsen <[EMAIL PROTECTED]>
wrote:
> Below is the chunk of code i am using.  In the verify_faculty_info.php 
> file i call the search function.  The search function is coded in the 
> function.php file which is included in the accesscontrol.php.
> 
> I thought that it would carry over to the verify_Faculty_info.php file.
> Was I mistaken?
> 
> Thanks
> 
>  include('accesscontrol.php');
> if (isset($_GET['action'])){
> 
>  if ($_GET['action'] == "add" && $_SESSION['role'] == 1) {
>include('includes/add_product.php');
>  } elseif ($_GET['action'] == "verify") {
>echo "verifying now";
>search();
>include('includes/verify_faculty_info.php');
>  } else {
>echo "action asked for is not specified";  } } else {
>   echo "action is not specified";
> }
> ?>

Looks like it would work to me.  You might try function_exists() to help
track down the problem.  Probably a typo or mispelled function name.

--
Greg Donald
http://destiney.com/

--
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 question

2004-06-21 Thread Keith Greene
Aaron,
I copied your code to a test file called test.php and created the following 
pages as dummy includes:
verify_faculty_info.php, functions.php and accesscontrol.php
in functions.php, I created a dummy search function:
function search(){
return "Found!";
}

in verify_faculty_info.php, I made a call to the search function thusly:
echo search();
the test page, when called with the action=verify outputs the following:
verifying nowFound!
Found!
If you are not getting the output you are expecting, it probably isn't 
because of a function not being available, but more like variables are not 
available to the function.
Are you getting any error messages at all?

Keith
At 08:31 AM 6/21/2004, Aaron Axelsen wrote:
Below is the chunk of code i am using.  In the verify_faculty_info.php
file i call the search function.  The search function is coded in the
function.php file which is included in the accesscontrol.php.
I thought that it would carry over to the verify_Faculty_info.php file.
Was I mistaken?
Thanks

  if ($_GET['action'] == "add" && $_SESSION['role'] == 1) {
include('includes/add_product.php');
  } elseif ($_GET['action'] == "verify") {
echo "verifying now";
search();
include('includes/verify_faculty_info.php');
  } else {
echo "action asked for is not specified";
  }
} else {
   echo "action is not specified";
}
?>
--
Aaron Axelsen
aim: aaak2
email: [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 question

2004-06-21 Thread Greg Donald
On Mon, 21 Jun 2004 10:31:42 -0500 (CDT), Aaron Axelsen
<[EMAIL PROTECTED]> wrote:
> Below is the chunk of code i am using.  In the verify_faculty_info.php
> file i call the search function.  The search function is coded in the
> function.php file which is included in the accesscontrol.php.
> 
> I thought that it would carry over to the verify_Faculty_info.php file.
> Was I mistaken?
> 
> Thanks
> 
>  include('accesscontrol.php');
> if (isset($_GET['action'])){
> 
>  if ($_GET['action'] == "add" && $_SESSION['role'] == 1) {
>include('includes/add_product.php');
>  } elseif ($_GET['action'] == "verify") {
>echo "verifying now";
>search();
>include('includes/verify_faculty_info.php');
>  } else {
>echo "action asked for is not specified";
>  }
> } else {
>   echo "action is not specified";
> }
> ?>

Looks like it would work to me.  You might try function_exists() to
help track down the problem.  Probably a typo or mispelled function
name.

-- 
Greg Donald
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] include question

2003-06-28 Thread John Luxford
Hi Blake,

If you're using Apache, try this:

http://ca3.php.net/virtual

Cheers,

Lux

On Friday, June 27, 2003, at 01:05 PM, Blake Schroeder wrote:

Hey all

I used to include a perl script via Sever Side Include how could I do 
this in php?

example:

--
Blake Schroeder
[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--

John Luxford
President and Chief Developer
__
SIMIAN systems
Driving Web Content Management
__
web   : http://www.simian.ca/
email : [EMAIL PROTECTED]
phone : 204.942.8630
fax   : 309.218.3874
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] include question

2003-06-27 Thread Leif K-Brooks
Blake Schroeder wrote:

Hey all

I used to include a perl script via Sever Side Include how could I do 
this in php?

example:

You can't use SSI in PHP.  PHP is not SSI.  You can do something similar 
though, www.php.net/virtual.

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] include question

2003-06-27 Thread Jay Blanchard
[snip]
I used to include a perl script via Sever Side Include how could I do 
this in php?

example:

[/snip]

exec("/cgi-bin/something.pl?data=something");

HTH

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Include Question

2003-03-27 Thread Jennifer Goodie
If your include is located somewhere on the site you should refer to it as
$_SERVER[DOCUMENT_ROOT]/pathtofile/filename.php so that your paths don't get
messed up from chaning the includes etc.

-Original Message-
From: Beauford.2002 [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 27, 2003 2:28 PM
To: James E Hicks III
Cc: PHP General
Subject: Re: [PHP] Include Question


Just a typo, but now I have other problems as well which I think have to do
with paths and includes.  If I am in the root directory on page main.html
and click on a link that is in /other - because this is a restricted page I
include main.html with an error (which right now doesn't display) - but now
the paths are all screwed up. If I click on the same link again I get file
not found. Hope I am explaining this right as this is really getting on my
nerves.

TIA

- Original Message -
From: "James E Hicks III" <[EMAIL PROTECTED]>
To: "Beauford.2002" <[EMAIL PROTECTED]>
Sent: Thursday, March 27, 2003 4:15 PM
Subject: RE: [PHP] Include Question


> If checklogin.php is only below, you shouldnn't get those errors. Anyway,
> is password just a typo below or does your code omit the $ too?
>
>
> if (!$name || !password) {
>  $message = $enter_info;
>  include ("login.php");
>  exit;
> }
>
> -Original Message-
> From: Beauford.2002 [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 27, 2003 4:07 PM
> To: James E Hicks III
> Subject: Re: [PHP] Include Question
>
>
> Because I would get the error - headers already sent etc.
>
> - Original Message -
> From: "James E Hicks III" <[EMAIL PROTECTED]>
> To: "Beauford.2002" <[EMAIL PROTECTED]>
> Sent: Thursday, March 27, 2003 3:53 PM
> Subject: RE: [PHP] Include Question
>
>
> > Why not try header("login.php") instead of include?
> >
> > James Hicks
> >
> >
> > -Original Message-
> > From: Beauford.2002 [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, March 27, 2003 3:47 PM
> > To: PHP General
> > Subject: [PHP] Include Question
> >
> >
> > Hi,
> >
> > First, I fixed my other problem of the stack overflow by moving the
files
> > back to the root directory (although I would rather have them in a login
> > directory). Anyway, I have a question regarding the include function. I
> have
> > a login script in a file called login.php - in this file it includes
> > checklogin.php and loginerrors.php. If the user inputs an incorrect
login
> I
> > assign $messages the appropriate error from loginerrors, then I
re-include
> > login.php where I want to show the error message, but no matter what I
do
> > the error message will not show up.
> >
> > Example.
> >
> > Login.php 
> >
> > Enter your Name:
> > Enter Your Password:
> > if ($message) { echo $message; }
> >
> > Checklogin.php
> >
> > if (!$name || !password) {
> > $message = $enter_info;
> > include ("login.php");
> > exit;
> > }
> >
> > Any help is appreciated.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Include Question

2003-03-27 Thread Beauford.2002
Just a typo, but now I have other problems as well which I think have to do
with paths and includes.  If I am in the root directory on page main.html
and click on a link that is in /other - because this is a restricted page I
include main.html with an error (which right now doesn't display) - but now
the paths are all screwed up. If I click on the same link again I get file
not found. Hope I am explaining this right as this is really getting on my
nerves.

TIA

- Original Message -
From: "James E Hicks III" <[EMAIL PROTECTED]>
To: "Beauford.2002" <[EMAIL PROTECTED]>
Sent: Thursday, March 27, 2003 4:15 PM
Subject: RE: [PHP] Include Question


> If checklogin.php is only below, you shouldnn't get those errors. Anyway,
> is password just a typo below or does your code omit the $ too?
>
>
> if (!$name || !password) {
>  $message = $enter_info;
>  include ("login.php");
>  exit;
> }
>
> -Original Message-
> From: Beauford.2002 [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 27, 2003 4:07 PM
> To: James E Hicks III
> Subject: Re: [PHP] Include Question
>
>
> Because I would get the error - headers already sent etc.
>
> - Original Message -
> From: "James E Hicks III" <[EMAIL PROTECTED]>
> To: "Beauford.2002" <[EMAIL PROTECTED]>
> Sent: Thursday, March 27, 2003 3:53 PM
> Subject: RE: [PHP] Include Question
>
>
> > Why not try header("login.php") instead of include?
> >
> > James Hicks
> >
> >
> > -Original Message-
> > From: Beauford.2002 [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, March 27, 2003 3:47 PM
> > To: PHP General
> > Subject: [PHP] Include Question
> >
> >
> > Hi,
> >
> > First, I fixed my other problem of the stack overflow by moving the
files
> > back to the root directory (although I would rather have them in a login
> > directory). Anyway, I have a question regarding the include function. I
> have
> > a login script in a file called login.php - in this file it includes
> > checklogin.php and loginerrors.php. If the user inputs an incorrect
login
> I
> > assign $messages the appropriate error from loginerrors, then I
re-include
> > login.php where I want to show the error message, but no matter what I
do
> > the error message will not show up.
> >
> > Example.
> >
> > Login.php 
> >
> > Enter your Name:
> > Enter Your Password:
> > if ($message) { echo $message; }
> >
> > Checklogin.php
> >
> > if (!$name || !password) {
> > $message = $enter_info;
> > include ("login.php");
> > exit;
> > }
> >
> > Any help is appreciated.
> >
> >
> >
> > --
> > 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 question

2003-01-15 Thread Christoph Grottolo
[EMAIL PROTECTED] (Brad Bonkoski) wrote:

>It would probably be best to include the absolute path to the images.
>so instead of:  use: 
>Is something like that possible?

??? forget this... this will only work on some browsers and as long as
you keep the files exactly there.

>Otherwise at the very least you should use: 

 (slash instead of back slash).

>> In c:\project\htmls there are several HTML documents which refer to images
>> in the project\htmls directory with tags like 
>>
>> In my PHP script in c:\project I include "htmls/file.html" and the HTML file
>> renders alright from the script, but the image's path is c:\project\file.gif
>> when the page is rendered, not c:\project\htmls\file.gif like it should be.

If you include a file into a php script like you do, the HTML-paths
will be relative to that php script, not to the original HTML-file.
PHP includes the file as is (imagine it puts the HTML code at the
place of the include statement) The browser does not know that there
is another HTML file, it only sees the output of the php script. 

Christoph


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] include question

2003-01-15 Thread Ryan Cassin
No unfortunately something like that isn't possible... The HTML files
are generated by a closed-source application.

-Original Message-
From: Brad Bonkoski [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 15, 2003 5:04 PM
To: Ryan
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] include question


It would probably be best to include the absolute path to the images. so
instead of:  use:  Is something like that possible?
Otherwise at the very least you should use: 
HTH -Brad Ryan wrote:

> Hello all,
>
> I'm have a PHP script that works in a folder.. for the sake of clarity

> we'll call it c:\project
>
> In c:\project\htmls there are several HTML documents which refer to 
> images in the project\htmls directory with tags like  src="file.gif">
>
> In my PHP script in c:\project I include "htmls/file.html" and the 
> HTML file renders alright from the script, but the image's path is 
> c:\project\file.gif when the page is rendered, not 
> c:\project\htmls\file.gif like it should be. Is there any way to 
> change the "working directory" so when I include a file images are on 
> the page, too?
>
> Thanks in advance!
>
> --
> Ryan Cassin
> [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 question

2003-01-15 Thread Brad Bonkoski
It would probably be best to include the absolute path to the images.
so instead of:  use: 
Is something like that possible?
Otherwise at the very least you should use: 
HTH
-Brad
Ryan wrote:

> Hello all,
>
> I'm have a PHP script that works in a folder.. for the sake of clarity we'll
> call it c:\project
>
> In c:\project\htmls there are several HTML documents which refer to images
> in the project\htmls directory with tags like 
>
> In my PHP script in c:\project I include "htmls/file.html" and the HTML file
> renders alright from the script, but the image's path is c:\project\file.gif
> when the page is rendered, not c:\project\htmls\file.gif like it should be.
> Is there any way to change the "working directory" so when I include a file
> images are on the page, too?
>
> Thanks in advance!
>
> --
> Ryan Cassin
> [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" question

2002-12-12 Thread Ronald Clark
Thanks!  Works perfect with double quotes!

RC


-Original Message-
From: Tom Rogers [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, December 12, 2002 8:21 AM
To: Ronald Clark
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] "include" question


Hi,

Friday, December 13, 2002, 12:07:05 AM, you wrote:
R> Hello all,

R> I am passing a variable like so:
R> 

R> On the "link.php" page, I have this simple code:
R>  $job = $_GET['foo'];
R> echo "$job";   // for error checking
R> include 'path/to/$job';
?>>

R> The 'echo "$job";' statement works just fine, but the outbout for the 
R> include statement looks like this: bar.php
R> Warning: Failed opening 'scripts/$job' for inclusion
R> (include_path='.:/usr/local/lib/php') in
/usr/local/www/data-dist/link.php
R> on line 142

R> Can I not use a $variable in an include 'something.php '; statement?

R> Thanks in advance,
R> Ron Clark


You have to use double quotes like:
include "path/to/$job"

or add like this:

include 'path/to/'.$job

-- 
regards,
Tom


CONFIDENTIALITY NOTICE:



The information contained in this ELECTRONIC MAIL transmission
is confidential.  It may also be privileged work product or proprietary
information. This information is intended for the exclusive use of the
addressee(s).  If you are not the intended recipient, you are hereby
notified that any use, disclosure, dissemination, distribution [other
than to the addressee(s)], copying or taking of any action because
of this information is strictly prohibited.





Re: [PHP] "include" question

2002-12-12 Thread Tom Rogers
Hi,

Friday, December 13, 2002, 12:07:05 AM, you wrote:
R> Hello all,

R> I am passing a variable like so:
R> 

R> On the "link.php" page, I have this simple code:
R>  $job = $_GET['foo'];
R> echo "$job";   // for error checking
R> include 'path/to/$job';
?>>

R> The 'echo "$job";' statement works just fine, but the outbout for the
R> include statement looks like this:
R> bar.php
R> Warning: Failed opening 'scripts/$job' for inclusion
R> (include_path='.:/usr/local/lib/php') in /usr/local/www/data-dist/link.php
R> on line 142

R> Can I not use a $variable in an include 'something.php '; statement?

R> Thanks in advance,
R> Ron Clark


You have to use double quotes like:
include "path/to/$job"

or add like this:

include 'path/to/'.$job

-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] "include" question

2002-12-12 Thread Leif K-Brooks
Variables don't get parsed in single quotes, use double quotes.

RClark wrote:


Hello all,

I am passing a variable like so:


On the "link.php" page, I have this simple code:

$job = $_GET['foo'];
echo "$job";   // for error checking
include 'path/to/$job';
?>

The 'echo "$job";' statement works just fine, but the outbout for the
include statement looks like this:
bar.php
Warning: Failed opening 'scripts/$job' for inclusion
(include_path='.:/usr/local/lib/php') in /usr/local/www/data-dist/link.php
on line 142

Can I not use a $variable in an include 'something.php '; statement?

Thanks in advance,
Ron Clark



 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] include() question...

2002-06-20 Thread David Freeman


 > Okay, let's say I want to send a user to a certain webpage...
 > 
 > usually I would use...
 > 
 > include("website.php");
 > 
 > but, if i want to send a user to a website along with a 
 > variable like...
 > 
 > $temp = "website.php?var=".$var;
 > include($temp);
 > 
 > ...this doesn't work.  

If you are just including the file in what's already loading then all
you need to do is make sure that $var is already set when you include
the file.  Including is logically the same as opening up the other file
and then doing a copy/paste into the current page.  It's exactly the
same as if the contents of your included file was in the file that's
doing the including.

If you are actually trying to load a new page and pass a variable to it
then you probably want to look at using header("Location:
website.php?var=$var"); instead.  This will actually load a whole new
page in the browser rather than just including an extra file in a page
that's already being loaded.

CYA, Dave



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] include() question...

2002-06-20 Thread Philip Olson


> but, if i want to send a user to a website along 
> with a variable like...
> 
> $temp = "website.php?var=".$var;
> include($temp);
> 
> ...this doesn't work.  

Example:



somefile.php now has access to $var.  This is 
talked about in the manual too:

  http://www.php.net/include

In your case above, $var will already be available 
to website.php if you simply include it.

Regards,
Philip Olson


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] include() question...

2002-06-20 Thread Purushotham Komaravolu

use header
ob_start()
$temp = "website.php?var=".$var;
header ("Location: $temp");


Puru
- Original Message - 
From: "Phil Schwarzmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 20, 2002 4:31 PM
Subject: [PHP] include() question...


> Okay, let's say I want to send a user to a certain webpage...
> 
> usually I would use...
> 
> include("website.php");
> 
> but, if i want to send a user to a website along with a variable like...
> 
> $temp = "website.php?var=".$var;
> include($temp);
> 
> ...this doesn't work.  
> 
> any suggestions??
> 
> THANKS!!
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Include question

2002-06-11 Thread David Freeman


 > somefile.php
 >  $apple = 'green';
 > $pear = 'yellow';
 > ?>
 > 
 > callfile.php
 >  include 'somefile.php';
 > echo "Apples are $apple and Pears are $pear"; \\ which would 
 > return the 
 > line with green and yellow in the correct spots.
 > ?>
 > 
 > But when I just do
 > 
 >  include 'somefile.php';
 > ?>
 > 
 > It prints:
 > $apple = 'green'; $pear = 'yellow':

Looks to me like your include file isn't being interpreted as php for
some reason.  Is the information here your exact test case or is it
different.  Certainly, as you've got it here, it would work - at least
it does for the numerous php projects I've done.

CYA, Dave

--
--
Outback Queensland Internet   
Longreach ** New Web Site Online *
Queensland
Australia W: www.outbackqld.net.au




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Include question

2002-06-11 Thread Tom Ray

Well I got it solved. It would help if I formatted my files correctly.

Sorry about that, i've been messing with PHP for about a year now, but 
am now really diving into it so I may have stupid questions here and 
there :)

TIA to all for help.

John Holmes wrote:

>Umm...that's what it's supposed to do...it's "including" it...
>
>---John Holmes...
>
>  
>
>>-Original Message-
>>From: Tom Ray [mailto:[EMAIL PROTECTED]]
>>Sent: Tuesday, June 11, 2002 9:29 PM
>>To: [EMAIL PROTECTED]
>>Subject: [PHP] Include question
>>
>>I'm trying to use the include function in some PHP scripts, but when I
>>
>>
>do
>  
>
>>include 'config.inc'; or include 'config.php;
>>
>>It returns all the information in the file when I look at my test php
>>file (which calls the include) Anyone know why this is?
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>  
>




RE: [PHP] Include question

2002-06-11 Thread Peter

Tom,

just did ur test on win2k php 4.2.1 with apache and when i just did .. 



i get a blank screen as I should

the only way you should be getting anything is by calling the values...

-Original Message-
From: Tom Ray [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 12 June 2002 11:36 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Include question


Yes, but according to http://www.php.net/manual/en/function.include.php 
I should be able to delcare the include and then pull the information 
out normally. So by what the manual says I can do this

somefile.php


callfile.php


But when I just do



It prints:
$apple = 'green'; $pear = 'yellow':


Why is that?


John Holmes wrote:

>Umm...that's what it's supposed to do...it's "including" it...
>
>---John Holmes...
>
>  
>
>>-Original Message-
>>From: Tom Ray [mailto:[EMAIL PROTECTED]]
>>Sent: Tuesday, June 11, 2002 9:29 PM
>>To: [EMAIL PROTECTED]
>>Subject: [PHP] Include question
>>
>>I'm trying to use the include function in some PHP scripts, but when I
>>
>>
>do
>  
>
>>include 'config.inc'; or include 'config.php;
>>
>>It returns all the information in the file when I look at my test php
>>file (which calls the include) Anyone know why this is?
>>
>>
>>--
>>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 question

2002-06-11 Thread Justin French

Check that you actually have  wrapped around the PHP code in
somefile.php that you include.

Justin French


on 12/06/02 11:36 AM, Tom Ray ([EMAIL PROTECTED]) wrote:

> Yes, but according to http://www.php.net/manual/en/function.include.php
> I should be able to delcare the include and then pull the information
> out normally. So by what the manual says I can do this
> 
> somefile.php
>  $apple = 'green';
> $pear = 'yellow';
> ?>
> 
> callfile.php
>  include 'somefile.php';
> echo "Apples are $apple and Pears are $pear"; \\ which would return the
> line with green and yellow in the correct spots.
> ?>
> 
> But when I just do
> 
>  include 'somefile.php';
> ?>
> 
> It prints:
> $apple = 'green'; $pear = 'yellow':
> 
> 
> Why is that?
> 
> 
> John Holmes wrote:
> 
>> Umm...that's what it's supposed to do...it's "including" it...
>> 
>> ---John Holmes...
>> 
>> 
>> 
>>> -Original Message-
>>> From: Tom Ray [mailto:[EMAIL PROTECTED]]
>>> Sent: Tuesday, June 11, 2002 9:29 PM
>>> To: [EMAIL PROTECTED]
>>> Subject: [PHP] Include question
>>> 
>>> I'm trying to use the include function in some PHP scripts, but when I
>>> 
>>> 
>> do
>> 
>> 
>>> include 'config.inc'; or include 'config.php;
>>> 
>>> It returns all the information in the file when I look at my test php
>>> file (which calls the include) Anyone know why this is?
>>> 
>>> 
>>> --
>>> 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 question

2002-06-11 Thread Tom Ray

Yes, but according to http://www.php.net/manual/en/function.include.php 
I should be able to delcare the include and then pull the information 
out normally. So by what the manual says I can do this

somefile.php


callfile.php


But when I just do



It prints:
$apple = 'green'; $pear = 'yellow':


Why is that?


John Holmes wrote:

>Umm...that's what it's supposed to do...it's "including" it...
>
>---John Holmes...
>
>  
>
>>-Original Message-
>>From: Tom Ray [mailto:[EMAIL PROTECTED]]
>>Sent: Tuesday, June 11, 2002 9:29 PM
>>To: [EMAIL PROTECTED]
>>Subject: [PHP] Include question
>>
>>I'm trying to use the include function in some PHP scripts, but when I
>>
>>
>do
>  
>
>>include 'config.inc'; or include 'config.php;
>>
>>It returns all the information in the file when I look at my test php
>>file (which calls the include) Anyone know why this is?
>>
>>
>>--
>>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 question

2002-06-11 Thread John Holmes

Umm...that's what it's supposed to do...it's "including" it...

---John Holmes...

> -Original Message-
> From: Tom Ray [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 11, 2002 9:29 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Include question
> 
> I'm trying to use the include function in some PHP scripts, but when I
do
> 
> include 'config.inc'; or include 'config.php;
> 
> It returns all the information in the file when I look at my test php
> file (which calls the include) Anyone know why this is?
> 
> 
> --
> 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 question

2002-06-02 Thread Analysis & Solutions

Hey John:

On Sun, Jun 02, 2002 at 12:10:27AM -0400, John Holmes wrote:
> 
> What I'm looking at is if each include .html file is 50K, am I loading
> 100K into memory and then running the script, or running the script and
> only loading the appropriate 50K into memory when it's needed?

As of 4.0.2, stuff is only loaded when it's needed.  So, in your 
example, only 50k is brought in.

Note, this is yet another case where it pays for me to read the manual
before posting!  I was still thinking in the old way, where include() 
was conditional and require() was always done.

Ciao!

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Include question

2002-06-02 Thread Bogdan Stancescu

You're right, that wouldn't prove my point. However, you might try a 
little piece of code like the following:



I hope this proves that includes are included at runtime because PHP 
wouldn't know what $b and $c are beforehand. Apart from that, I'm 
positive I read about it in a man page, but can't recall which, that's 
why I didn't direct you to it ;-)

Bogdan

John Holmes wrote:

>The global var wouldn't work. Even if both are loaded into memory before
>the script is ran, only one include will actually be executed along with
>the code, so only one would end up affecting a global var either way. 
>
>What I'm looking at is if each include .html file is 50K, am I loading
>100K into memory and then running the script, or running the script and
>only loading the appropriate 50K into memory when it's needed?
>
>---John Holmes...
>
>  
>
>>-Original Message-
>>From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
>>Sent: Saturday, June 01, 2002 11:12 PM
>>To: [EMAIL PROTECTED]
>>Cc: [EMAIL PROTECTED]
>>Subject: Re: [PHP] Include question
>>
>>Your second guess. But you could've tested it easily with two includes
>>appending stuff to the same global var.
>>
>>Bogdan
>>
>>John Holmes wrote:
>>
>>
>>
>>>Hi. When I've got code like the following:
>>>
>>>if($this) { include("this.html"); }
>>>elseif($that) { include("that.html"); }
>>>
>>>When are the includes() evaluated? Does the Zend engine do the
>>>  
>>>
>includes
>  
>
>>>first, pull in all of the code, then process it and produce output.
>>>  
>>>
>Or
>  
>
>>>does the engine start processing the code and only load the includes
>>>when it gets to them?
>>>
>>>Thanks for any explanations.
>>>
>>>---John Holmes.
>>>
>>>
>>>
>>>  
>>>
>
>
>
>  
>




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Include question

2002-06-01 Thread John Holmes

The global var wouldn't work. Even if both are loaded into memory before
the script is ran, only one include will actually be executed along with
the code, so only one would end up affecting a global var either way. 

What I'm looking at is if each include .html file is 50K, am I loading
100K into memory and then running the script, or running the script and
only loading the appropriate 50K into memory when it's needed?

---John Holmes...

> -Original Message-
> From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 01, 2002 11:12 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Include question
> 
> Your second guess. But you could've tested it easily with two includes
> appending stuff to the same global var.
> 
> Bogdan
> 
> John Holmes wrote:
> 
> >Hi. When I've got code like the following:
> >
> >if($this) { include("this.html"); }
> >elseif($that) { include("that.html"); }
> >
> >When are the includes() evaluated? Does the Zend engine do the
includes
> >first, pull in all of the code, then process it and produce output.
Or
> >does the engine start processing the code and only load the includes
> >when it gets to them?
> >
> >Thanks for any explanations.
> >
> >---John Holmes.
> >
> >
> >
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Include question

2002-06-01 Thread Bogdan Stancescu

Your second guess. But you could've tested it easily with two includes 
appending stuff to the same global var.

Bogdan

John Holmes wrote:

>Hi. When I've got code like the following:
> 
>if($this) { include("this.html"); }
>elseif($that) { include("that.html"); }
> 
>When are the includes() evaluated? Does the Zend engine do the includes
>first, pull in all of the code, then process it and produce output. Or
>does the engine start processing the code and only load the includes
>when it gets to them?
> 
>Thanks for any explanations.
> 
>---John Holmes.
>
>  
>




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] include() question

2002-03-14 Thread Dave

Missing close " for one.
 v
include("index.php?var='$var'");
 ^
and you don't need to pass the $var to the include since it will be included,
and obviously you already have it declared.

if index.php contained


and the file you are in contained


then PHP reads this as


as such, no need to pass $var to the file since the file is included then
parsed.

Dave





>-Original Message-
>From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, March 14, 2002 4:20 PM
>To: [EMAIL PROTECTED]
>Subject: [PHP] include() question
>
>
>Why doesn't this work...
>
>include("index.php?var='$var');
>
>I want to include a page in my code and send a variable to it but I get
>some funky error.
>
>THANKS!!
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] include() question

2002-03-14 Thread Lars Torben Wilson

On Thu, 2002-03-14 at 13:20, Phil Schwarzmann wrote:
> Why doesn't this work...
>  
> include("index.php?var='$var');
>  
> I want to include a page in my code and send a variable to it but I get
> some funky error.
>  
> THANKS!!

Please read this page carefully, especially the third paragraph and 
Examples 11.3 and 11.5: 

 http://www.php.net/manual/en/function.include.php

Hopefully that's help clear it up.

Essentially, you should be doing this:

  $var = 'someval';
  include('index.php');


Hope this helps,

Torben

-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] include() question

2002-03-14 Thread Erik Price

Oh I see.  Sorry, i was thinking apples and you guys were talking about 
oranges.  I just ran into this problem a little while ago, that's why I 
felt the need to butt in.

Erik



On Thursday, March 14, 2002, at 05:08  PM, Edward van Bilderbeek - Bean 
IT wrote:

> Jep, that was what I meant... sorry Erik, didn't read your question 
> right...
>
> Edward
>
> - Original Message -
> From: "Jan Rademaker" <[EMAIL PROTECTED]>
> To: "Erik Price" <[EMAIL PROTECTED]>
> Cc: "Edward van Bilderbeek - Bean IT" <[EMAIL PROTECTED]>; "Phil
> Schwarzmann" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Thursday, March 14, 2002 11:03 PM
> Subject: Re: [PHP] include() question
>
>
>> On Thu, 14 Mar 2002, Erik Price wrote:
>>
>>>
>>> On Thursday, March 14, 2002, at 04:34  PM, Edward van Bilderbeek - 
>>> Bean
>>> IT wrote:
>>>
>>>> you can't use a variable as a parameter for the included file...
> because
>>>> include does nothing else then putting the text of the include file 
>>>> on
>>>> the
>>>> place of the include statement...
>>>
>>> Are you sure about this?  I'm almost positive that PHP is flexible 
>>> about
>>> accepting variables or strings as function arguments in most cases.  I
>>> just tested it, and it seems to work fine...
>>>
>>> $includefile = './leftnavigation.inc';
>>> include($includefile);
>>>
>> I think what Edward means is that you can't pass parameters to an 
>> included
>> file, like include("some.inc?var=value");
>> That's true, at least for local
>> files. include("http://remotesite/some.php?var=value";) will work, as 
>> long
>> as remotesite has php installed, of course.
>>
>> --
>> Jan Rademaker <[EMAIL PROTECTED]>
>> http://www.ottobak.com
>>
>>
>
>







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] include() question

2002-03-14 Thread Erik Price


On Thursday, March 14, 2002, at 05:03  PM, Jan Rademaker wrote:

> I think what Edward means is that you can't pass parameters to an 
> included
> file, like include("some.inc?var=value");
> That's true, at least for local
> files. include("http://remotesite/some.php?var=value";) will work, as 
> long
> as remotesite has php installed, of course.

yes, a very clean way to do it (that I've used successfully) is 
something like:

$current_page = "User Login";
if ($badlogin) {
header("Location: http://domain.com/~eprice/badlogin.php?errormsg="; . 
$current_page);
}

This cleanly separates the string from the variable, but they are 
concatenated before being passed as an argument to the header() 
function.  This passes the name of the script as a querystring variable 
called $_GET['errormsg'], so that the receiving script can take some 
action based on where the user was sent from.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] include() question

2002-03-14 Thread Edward van Bilderbeek - Bean IT

Jep, that was what I meant... sorry Erik, didn't read your question right...

Edward

- Original Message -
From: "Jan Rademaker" <[EMAIL PROTECTED]>
To: "Erik Price" <[EMAIL PROTECTED]>
Cc: "Edward van Bilderbeek - Bean IT" <[EMAIL PROTECTED]>; "Phil
Schwarzmann" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, March 14, 2002 11:03 PM
Subject: Re: [PHP] include() question


> On Thu, 14 Mar 2002, Erik Price wrote:
>
> >
> > On Thursday, March 14, 2002, at 04:34  PM, Edward van Bilderbeek - Bean
> > IT wrote:
> >
> > > you can't use a variable as a parameter for the included file...
because
> > > include does nothing else then putting the text of the include file on
> > > the
> > > place of the include statement...
> >
> > Are you sure about this?  I'm almost positive that PHP is flexible about
> > accepting variables or strings as function arguments in most cases.  I
> > just tested it, and it seems to work fine...
> >
> > $includefile = './leftnavigation.inc';
> > include($includefile);
> >
> I think what Edward means is that you can't pass parameters to an included
> file, like include("some.inc?var=value");
> That's true, at least for local
> files. include("http://remotesite/some.php?var=value";) will work, as long
> as remotesite has php installed, of course.
>
> --
> Jan Rademaker <[EMAIL PROTECTED]>
> http://www.ottobak.com
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] include() question

2002-03-14 Thread Edward van Bilderbeek - Bean IT

Hmmm, now I'm in doubt... I always had errors using it, so I stopped using
it... I also have problems with variables that have the same name and are in
both the original file and the included file... might it have something to
do with the PHP version you're working on?

Greets,

Edward

- Original Message -
From: "Erik Price" <[EMAIL PROTECTED]>
To: "Edward van Bilderbeek - Bean IT" <[EMAIL PROTECTED]>
Cc: "Phil Schwarzmann" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, March 14, 2002 10:58 PM
Subject: Re: [PHP] include() question


>
> On Thursday, March 14, 2002, at 04:34  PM, Edward van Bilderbeek - Bean
> IT wrote:
>
> > you can't use a variable as a parameter for the included file... because
> > include does nothing else then putting the text of the include file on
> > the
> > place of the include statement...
>
> Are you sure about this?  I'm almost positive that PHP is flexible about
> accepting variables or strings as function arguments in most cases.  I
> just tested it, and it seems to work fine...
>
> $includefile = './leftnavigation.inc';
> include($includefile);
>
> I posted a question on this list about a month ago, and someone said
> that you can use variables or strings in many cases -- just remember
> that the variable expands to the string BEFORE being processed by the
> function.
>
> Erik
>
>
>
>
> 
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [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() question

2002-03-14 Thread Erik Price


On Thursday, March 14, 2002, at 04:34  PM, Edward van Bilderbeek - Bean 
IT wrote:

> you can't use a variable as a parameter for the included file... because
> include does nothing else then putting the text of the include file on 
> the
> place of the include statement...

Are you sure about this?  I'm almost positive that PHP is flexible about 
accepting variables or strings as function arguments in most cases.  I 
just tested it, and it seems to work fine...

$includefile = './leftnavigation.inc';
include($includefile);

I posted a question on this list about a month ago, and someone said 
that you can use variables or strings in many cases -- just remember 
that the variable expands to the string BEFORE being processed by the 
function.

Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] include() question

2002-03-14 Thread Edward van Bilderbeek - Bean IT

you can't use a variable as a parameter for the included file... because
include does nothing else then putting the text of the include file on the
place of the include statement...

so this should work:

$var = 'bladibla';
include('index.php');


Greets,

Edward


- Original Message -
From: "Phil Schwarzmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 14, 2002 10:20 PM
Subject: [PHP] include() question


> Why doesn't this work...
>
> include("index.php?var='$var');
>
> I want to include a page in my code and send a variable to it but I get
> some funky error.
>
> THANKS!!
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] include() question

2002-03-14 Thread Demitrious S. Kelly

Try to simplify the problem
$file='index.php?var=';
$file.=$var;
include($file);

-Original Message-
From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, March 14, 2002 1:20 PM
To: [EMAIL PROTECTED]
Subject: [PHP] include() question

Why doesn't this work...
 
include("index.php?var='$var');
 
I want to include a page in my code and send a variable to it but I get
some funky error.
 
THANKS!!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] include question

2001-09-17 Thread Scott

At 02:03 AM 9/18/2001 +0200, Chris Hayes wrote:
>  2) let them make a real template, either a file or a database
>cell, for instance
> fhkhfsahehfaa[DATA1]
>and do a str replace [DATA1] parts --> database content.

Chris-

YOU ROCK!  Thank you for the thought starter, I have been beating my head
on this most of the day.  I have to confess that this site was done in ASP and
I have been moving parts over to PHP and was not thinking clearly.  I was
thinking I was still under the ASP limitations :)

Anyway, here is the code I am using.  I will keep the templates in the db
and call them, but I put a [BODY DATA] block in the template file, and then
do a string replace as such:

$temp = str_replace("[BODY DATA]", $body,$template);

echo $temp;

Can anyone tell me the limit or format to do multiple replaces, example:
I have 5 fields that I need to replace, do I create a variable for each 
replacement?
$temp = str_replace("[BODY DATA]", $body,$template);
$temp2 = str_replace("[TOP_GRAPHIC]",$top_graphic, $temp);
and so on -OR- can I do it in one statement?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP]include question, WHY doesn't this work...

2001-07-23 Thread Gonyou, Austin

have you tried giving the absolute path to the included file? 

include("/some/path/to/a/file.php");



-- 
Austin Gonyou
Systems Architect, CCNA
Coremetrics, Inc.
Phone: 512-796-9023
email: [EMAIL PROTECTED] 

> -Original Message-
> From: Unni [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 23, 2001 2:53 PM
> To: Chris Cocuzzo
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP]include question, WHY doesn't this work...
> 
> 
> Is the lib direcotory under the working directory, I mean, if your 
> program is excuting  under temp directory, the lib directory 
> has to be 
> below temp directory. If you are running this program from the root 
> directory then lib has to be below root directory.
> Your code looks good to me.
> One more thing I can think of is, do you read access to lib 
> directory, 
> just curious.
> 
> Chris Cocuzzo wrote:
> 
> > hey-
> > 
> > I have a piece of code which does a simply INSERT query 
> into an mp3 table.
> > I've tested it out, and it completes the query, however 
> there is one bug
> > that I just have no clue about.
> > 
> > this code does not work when i try to connect to the db:
> > include("lib/db_config.php");
> > 
> > $connection = db_connect("fplg");
> > if(!connection) {
> >  die(sql_error());
> > }
> > the include fails and so the db_connect function is undefined.
> > 
> > this code works:
> > include("db_config.php");
> > 
> > $connection = db_connect("fplg");
> > if(!connection) {
> >  die(sql_error());
> > }
> > 
> > I DO have a directory called lib in my root folder. am I 
> calling the include
> > wrong in that first piece. Note that I also tried the first 
> one with a
> > foward slash in front of the 'lib', but had no luck.
> > 
> > help!
> > chris
> > 
> > 
> > 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: 
> [EMAIL PROTECTED]
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP]include question, WHY doesn't this work...

2001-07-23 Thread Chris Cocuzzo

the lib directory is under the root directory, or the www directory, where
all the normal files have been put. i figured out that the include worked
better when I specified the entire system path.

chris


- Original Message -
From: Unni <[EMAIL PROTECTED]>
To: Chris Cocuzzo <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, July 23, 2001 3:52 PM
Subject: Re: [PHP]include question, WHY doesn't this work...


> Is the lib direcotory under the working directory, I mean, if your
> program is excuting  under temp directory, the lib directory has to be
> below temp directory. If you are running this program from the root
> directory then lib has to be below root directory.
> Your code looks good to me.
> One more thing I can think of is, do you read access to lib directory,
> just curious.
>
> Chris Cocuzzo wrote:
>
> > hey-
> >
> > I have a piece of code which does a simply INSERT query into an mp3
table.
> > I've tested it out, and it completes the query, however there is one bug
> > that I just have no clue about.
> >
> > this code does not work when i try to connect to the db:
> > include("lib/db_config.php");
> >
> > $connection = db_connect("fplg");
> > if(!connection) {
> >  die(sql_error());
> > }
> > the include fails and so the db_connect function is undefined.
> >
> > this code works:
> > include("db_config.php");
> >
> > $connection = db_connect("fplg");
> > if(!connection) {
> >  die(sql_error());
> > }
> >
> > I DO have a directory called lib in my root folder. am I calling the
include
> > wrong in that first piece. Note that I also tried the first one with a
> > foward slash in front of the 'lib', but had no luck.
> >
> > help!
> > chris
> >
> >
> >
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP]include question, WHY doesn't this work...

2001-07-23 Thread Unni

Is the lib direcotory under the working directory, I mean, if your 
program is excuting  under temp directory, the lib directory has to be 
below temp directory. If you are running this program from the root 
directory then lib has to be below root directory.
Your code looks good to me.
One more thing I can think of is, do you read access to lib directory, 
just curious.

Chris Cocuzzo wrote:

> hey-
> 
> I have a piece of code which does a simply INSERT query into an mp3 table.
> I've tested it out, and it completes the query, however there is one bug
> that I just have no clue about.
> 
> this code does not work when i try to connect to the db:
> include("lib/db_config.php");
> 
> $connection = db_connect("fplg");
> if(!connection) {
>  die(sql_error());
> }
> the include fails and so the db_connect function is undefined.
> 
> this code works:
> include("db_config.php");
> 
> $connection = db_connect("fplg");
> if(!connection) {
>  die(sql_error());
> }
> 
> I DO have a directory called lib in my root folder. am I calling the include
> wrong in that first piece. Note that I also tried the first one with a
> foward slash in front of the 'lib', but had no luck.
> 
> help!
> chris
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]