Re: [PHP] Include Files in HTML

2009-09-06 Thread Ashley Sheridan
On Fri, 2009-09-04 at 18:21 -0500, phphelp -- kbk wrote:
 On Sep 4, 2009, at 5:03 PM, sono...@fannullone.us wrote:
 
  Depends on what you are including. The only tags that can be  
  inside the
  head are base, link, meta, script, style,  and title.
  Everything else is either body or prologue.
 
  I meant PHP includes like this one:
  ?php @include_once(/home/passwords/login.php); ?
 
 We know what you mean. Read the responses more carefully, as they are  
 telling you what you need to know.
 
 For simplification: The INCLUDE commands put the contents of the  
 INCLUDed file into this file, just as if as you had typed it in there.
 
 Ken
 
It's good to remember that PHP isn't inserted into HTML, but the other
way round. PHP can output HTML, but is often used to output many other
formats, from images to xml to documents.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



RE: [PHP] Include Files in HTML

2009-09-04 Thread Bob McConnell
From: sono-io at fannullone.us

   In my readings, I've run across examples showing include files
being  
 called from within the head/head tags, and other examples showing

 them called within body/body.  I've always put them in the header

 section myself, but I was wondering if one is better than the other,  
 or is it just personal preference?

Depends on what you are including. The only tags that can be inside the
head are base, link, meta, script, style,  and title.
Everything else is either body or prologue.

The full specs can be found at
http://www.w3schools.com/tags/default.asp.

Bob McConnell

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



RE: [PHP] Include Files in HTML

2009-09-04 Thread Joost
Bob McConnell wrote:

 From: sono-io at fannullone.us
 
 In my readings, I've run across examples showing include files
 being
 called from within the head/head tags, and other examples showing
 
 them called within body/body.  I've always put them in the header
 
 section myself, but I was wondering if one is better than the other,
 or is it just personal preference?
 
 Depends on what you are including. The only tags that can be inside the
 head are base, link, meta, script, style,  and title.
 Everything else is either body or prologue.
 
 The full specs can be found at
 http://www.w3schools.com/tags/default.asp.
 
 Bob McConnell

Sure enough. What the OP might not have realized:

In the end, what PHP evaluates to, is a stream of html, script, css etc 
text/data, which is sent to the browser. PHP's include( file ) statement 
inserts the content of file here-and-now. You can even put the include 
statement within a for loop in order to include something multiple times... 
In that sense it is more like a /function/ and really different from cpp's 
#include /directive/.

file can contain PHP code, which is evaluated as if it was here-and-now in 
the including PHP file; it can contain text/data, which is appended to the 
text/data stream being produced.

All in all, to PHP the spot of file inclusion is not interesting, as long as 
the resulting PHP code and/or stream data is meaningful.

Now back to you, Bob :-)

Regards,
Joost.

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



Re: [PHP] Include Files in HTML

2009-09-04 Thread sono-io


On Sep 4, 2009, at 1:05 PM, Bob McConnell wrote:

Depends on what you are including. The only tags that can be inside  
the

head are base, link, meta, script, style,  and title.
Everything else is either body or prologue.


I meant PHP includes like this one:
?php @include_once(/home/passwords/login.php); ?

Frank

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



Re: [PHP] Include Files in HTML

2009-09-04 Thread Tommy Pham
- Original Message 
 From: sono...@fannullone.us sono...@fannullone.us
 To: PHP General List php-general@lists.php.net
 Sent: Friday, September 4, 2009 12:57:08 PM
 Subject: [PHP] Include Files in HTML
 
 In my readings, I've run across examples showing include files being 
 called 
 from within the tags, and other examples showing them called 
 within .  I've always put them in the header section myself, but I 
 was wondering if one is better than the other, or is it just personal 
 preference?
 
 Frank
 
 --PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Depends on your application design and/or your desired result.  If you design 
your application to do all processing before output is sent starting with 
html, then all your includes goes before html.  If you want to have the 
modular approach of including css  js files inside the head element, you 
don't have to worry about going back to changing every single output file when 
you decide the change your layout or javascript framework.  It also makes your 
code page a bit cleaner when you do use include in the head.  If you want to 
make use of chunked encoding, you can including the rest within the body.

Thus, include everything before html gives you a slight pause 'waiting for 
reply...' in the status bar before the client even begin to download anything.  
When includes are scattered all over, server processes some sends the web 
browser info, here go fetch some more (css, js, images) until the the last 
buffered output is sent /html  (that is if your page is compliant ;)

Regards,
Tommy


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



Re: [PHP] Include Files in HTML

2009-09-04 Thread Tommy Pham
- Original Message 
 From: Tommy Pham tommy...@yahoo.com
 To: php-general@lists.php.net
 Sent: Friday, September 4, 2009 4:11:31 PM
 Subject: Re: [PHP] Include Files in HTML
 
 - Original Message 
  From: sono...@fannullone.us 
  To: PHP General List 
  Sent: Friday, September 4, 2009 12:57:08 PM
  Subject: [PHP] Include Files in HTML
  
  In my readings, I've run across examples showing include files being 
 called 
  from within the tags, and other examples showing them called 
  within .  I've always put them in the header section myself, but I 
  was wondering if one is better than the other, or is it just personal 
  preference?
  
  Frank
  
  --PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 Depends on your application design and/or your desired result.  If you design 
 your application to do all processing before output is sent starting with 
 , then all your includes goes before .  If you want to have the 
 modular approach of including css  js files inside the  element, you 
 don't have to worry about going back to changing every single output file 
 when 
 you decide the change your layout or javascript framework.  It also makes 
 your 
 code page a bit cleaner when you do use include in the .  If you want to 
 make use of chunked encoding, you can including the rest within the .
 
 Thus, include everything before  gives you a slight pause 'waiting for 
 reply...' in the status bar before the client even begin to download 
 anything.  
 When includes are scattered all over, server processes some sends the web 
 browser info, here go fetch some more (css, js, images) until the the last 
 buffered output is sent   (that is if your page is compliant ;)
 
 Regards,
 Tommy
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Forgot to mention a few things, if your app is sophisticated enough to require 
header settings (content-type, etc), those include have to go before the 
buffered output is sent.  Also, you want to make use of chunked encoding, you 
cannot use/specify content-length in the header.


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



Re: [PHP] Include Files in HTML

2009-09-04 Thread phphelp -- kbk

On Sep 4, 2009, at 5:03 PM, sono...@fannullone.us wrote:

Depends on what you are including. The only tags that can be  
inside the

head are base, link, meta, script, style,  and title.
Everything else is either body or prologue.


I meant PHP includes like this one:
?php @include_once(/home/passwords/login.php); ?


We know what you mean. Read the responses more carefully, as they are  
telling you what you need to know.


For simplification: The INCLUDE commands put the contents of the  
INCLUDed file into this file, just as if as you had typed it in there.


Ken

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



Re: [PHP] Include files....

2007-05-21 Thread Richard Lynch
An include jumps back into HTML mode so you need:

?php
  $server = ;
  $username = ;
.
.
.
?

On Fri, May 18, 2007 3:05 pm, Jason Pruim wrote:
 Okay, Very Newbie-ish question coming!

 I can't figure out why my include won't work... Here's the text:

 index.php:
 ?PHP

 include 'defaults.php';

 $link = mysql_connect($server, $username, $password) or die('Could
 not connect: ' . mysql_error());
 echo 'Connected successfully BR';
 mysql_select_db($database) or die('Could not select database: ' .
 mysql_error());
 echo 'DB selected BR';

 $result = mysql_query($query) or die(mysql_error());
 $num=mysql_numrows($result);
 $i= 0;


 while($i  $num) {

   $FName = mysql_result($result, $i,FName);
   $LName = mysql_result($result,$i,LName);
   $Add1 = mysql_result($result, $i,Add1);
   $Add2 = mysql_result($result, $i,Add2);
   $City = mysql_result($result, $i,City);
   $State = mysql_result($result, $i,State);
   $Zip = mysql_result($result, $i,Zip);
   $Date = date(m-d-y h:i:s,mysql_result($result, $i, Date));
   $Record = mysql_result($result, $i, Record);
   $subName = mysql_result($result, $i,subName);
   $subEmail = mysql_result($result, $i,subEmail);
   $subPhone = mysql_result($result, $i,subPhone);
   $chkMember = unserialize(mysql_result($result, $i,chkMember));
   $chkAdd = unserialize(mysql_result($result, $i,chkAdd));
   $chkDel = unserialize(mysql_result($result, $i, chkDel));

   $i++;

   //echo P$Record $FName, $LName,/P P$Add1,BR $Add2,BR/P
 P$City, $State, $Zip,/P $Date,BR $subName, $subEmail,
 $subPhone, $chkMember[$row], $chkAdd[$row], $chkDel[$row]BR;

   echo H3Name Address/H3;
   echo P id ='test' $FName $LName $Add1 $Add2 $Date/P;

 };




 ?
 *
 defaults.php:

 $server = 'localhost';
 $username = 'USERNAME';
 $password = 'PASSWORD';
 $database = 'DATABASE';
 $query = 'SELECT * FROM current';

 Yes I changed the values of username, password, and database. But
 when I use the same info inside the index.php file it all works just
 fine. Here is the error that it gives me:

 [Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
 server in /Volumes/RAIDer/webserver/Documents/tests/legion/index.php
 on line 5
 [Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
 username in /Volumes/RAIDer/webserver/Documents/tests/legion/
 index.php on line 5
 [Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
 password in /Volumes/RAIDer/webserver/Documents/tests/legion/
 index.php on line 5
 [Fri May 18 15:32:07 2007] [error] PHP Warning:  mysql_connect() [a
 href='function.mysql-connect'function.mysql-connect/a]: Access
 denied for user 'USERNAME'@'localhost' (using password: NO) in /
 Volumes/RAIDer/webserver/Documents/tests/legion/index.php on line 5


 Thanks in advance for helping me through my obvious friday afternoon
 brain fart...




 --

 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 3251 132nd ave
 Holland, MI, 49424
 www.raoset.com
 [EMAIL PROTECTED]





-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Include files....

2007-05-18 Thread Tijnema !

On 5/18/07, Jason Pruim [EMAIL PROTECTED] wrote:

Okay, Very Newbie-ish question coming!

I can't figure out why my include won't work... Here's the text:

index.php:
?PHP

include 'defaults.php';

$link = mysql_connect($server, $username, $password) or die('Could
not connect: ' . mysql_error());
echo 'Connected successfully BR';
mysql_select_db($database) or die('Could not select database: ' .
mysql_error());
echo 'DB selected BR';

$result = mysql_query($query) or die(mysql_error());
$num=mysql_numrows($result);
$i= 0;


while($i  $num) {

   $FName = mysql_result($result, $i,FName);
   $LName = mysql_result($result,$i,LName);
   $Add1 = mysql_result($result, $i,Add1);
   $Add2 = mysql_result($result, $i,Add2);
   $City = mysql_result($result, $i,City);
   $State = mysql_result($result, $i,State);
   $Zip = mysql_result($result, $i,Zip);
   $Date = date(m-d-y h:i:s,mysql_result($result, $i, Date));
   $Record = mysql_result($result, $i, Record);
   $subName = mysql_result($result, $i,subName);
   $subEmail = mysql_result($result, $i,subEmail);
   $subPhone = mysql_result($result, $i,subPhone);
   $chkMember = unserialize(mysql_result($result, $i,chkMember));
   $chkAdd = unserialize(mysql_result($result, $i,chkAdd));
   $chkDel = unserialize(mysql_result($result, $i, chkDel));

   $i++;

   //echo P$Record $FName, $LName,/P P$Add1,BR $Add2,BR/P
P$City, $State, $Zip,/P $Date,BR $subName, $subEmail,
$subPhone, $chkMember[$row], $chkAdd[$row], $chkDel[$row]BR;

   echo H3Name Address/H3;
   echo P id ='test' $FName $LName $Add1 $Add2 $Date/P;

};




?
*
defaults.php:

$server = 'localhost';
$username = 'USERNAME';
$password = 'PASSWORD';
$database = 'DATABASE';
$query = 'SELECT * FROM current';

Yes I changed the values of username, password, and database. But
when I use the same info inside the index.php file it all works just
fine. Here is the error that it gives me:

[Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
server in /Volumes/RAIDer/webserver/Documents/tests/legion/index.php
on line 5
[Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
username in /Volumes/RAIDer/webserver/Documents/tests/legion/
index.php on line 5
[Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
password in /Volumes/RAIDer/webserver/Documents/tests/legion/
index.php on line 5
[Fri May 18 15:32:07 2007] [error] PHP Warning:  mysql_connect() [a
href='function.mysql-connect'function.mysql-connect/a]: Access
denied for user 'USERNAME'@'localhost' (using password: NO) in /
Volumes/RAIDer/webserver/Documents/tests/legion/index.php on line 5


Thanks in advance for helping me through my obvious friday afternoon
brain fart...



I guess you forget that defaults.php is a php file and needs to start
with ?php and end with ?

Tijnema

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



Re: [PHP] Include files....

2007-05-18 Thread Jason Pruim


On May 18, 2007, at 4:12 PM, Tijnema ! wrote:




Thanks in advance for helping me through my obvious friday afternoon
brain fart...



I guess you forget that defaults.php is a php file and needs to start
with ?php and end with ?

Tijnema


Well there it is... The Brain fart... Or misunderstanding... I  
thought since I was calling it within another php script that I  
didn't have to include the ? ? tags? Obviously I was wrong...


Thanks Tijnema!




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] Include files....

2007-05-18 Thread Robert Cummings
On Fri, 2007-05-18 at 16:20 -0400, Jason Pruim wrote:
 On May 18, 2007, at 4:12 PM, Tijnema ! wrote:
 
 
 
  Thanks in advance for helping me through my obvious friday afternoon
  brain fart...
 
 
  I guess you forget that defaults.php is a php file and needs to start
  with ?php and end with ?
 
  Tijnema
 
 Well there it is... The Brain fart... Or misunderstanding... I  
 thought since I was calling it within another php script that I  
 didn't have to include the ? ? tags? Obviously I was wrong...

You don't need to close the PHP context with ?

PHP does it for you when it hits the end of the file... this is a
feature.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Include files....

2007-05-18 Thread Tijnema !

On 5/18/07, Robert Cummings [EMAIL PROTECTED] wrote:

On Fri, 2007-05-18 at 16:20 -0400, Jason Pruim wrote:
 On May 18, 2007, at 4:12 PM, Tijnema ! wrote:

 
 
  Thanks in advance for helping me through my obvious friday afternoon
  brain fart...
 
 
  I guess you forget that defaults.php is a php file and needs to start
  with ?php and end with ?
 
  Tijnema

 Well there it is... The Brain fart... Or misunderstanding... I
 thought since I was calling it within another php script that I
 didn't have to include the ? ? tags? Obviously I was wrong...

You don't need to close the PHP context with ?

PHP does it for you when it hits the end of the file... this is a
feature.

Cheers,
Rob.


Yes, it does, but well, doesn't it look nice an ending ? ??

Tijnema

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



Re: [PHP] Include files....

2007-05-18 Thread Robert Cummings
On Fri, 2007-05-18 at 22:31 +0200, Tijnema ! wrote:
 On 5/18/07, Robert Cummings [EMAIL PROTECTED] wrote:
  On Fri, 2007-05-18 at 16:20 -0400, Jason Pruim wrote:
   On May 18, 2007, at 4:12 PM, Tijnema ! wrote:
  
   
   
Thanks in advance for helping me through my obvious friday afternoon
brain fart...
   
   
I guess you forget that defaults.php is a php file and needs to start
with ?php and end with ?
   
Tijnema
  
   Well there it is... The Brain fart... Or misunderstanding... I
   thought since I was calling it within another php script that I
   didn't have to include the ? ? tags? Obviously I was wrong...
 
  You don't need to close the PHP context with ?
 
  PHP does it for you when it hits the end of the file... this is a
  feature.
 
  Cheers,
  Rob.
 
 Yes, it does, but well, doesn't it look nice an ending ? ??

Mostly, it looks like a dangling piece of rubbish. I never add the
closing ? on a source-only file. And since I never mix code with
content... I never see ? in my files *grin*.

The code generated by the template compiler has the appropriate closing
tags though... and of course since it's generated, it's a run-time soup
of HTML and embedded PHP code :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Include files....

2007-05-18 Thread Tijnema !

On 5/18/07, Robert Cummings [EMAIL PROTECTED] wrote:

On Fri, 2007-05-18 at 22:31 +0200, Tijnema ! wrote:
 On 5/18/07, Robert Cummings [EMAIL PROTECTED] wrote:
  On Fri, 2007-05-18 at 16:20 -0400, Jason Pruim wrote:
   On May 18, 2007, at 4:12 PM, Tijnema ! wrote:
  
   
   
Thanks in advance for helping me through my obvious friday afternoon
brain fart...
   
   
I guess you forget that defaults.php is a php file and needs to start
with ?php and end with ?
   
Tijnema
  
   Well there it is... The Brain fart... Or misunderstanding... I
   thought since I was calling it within another php script that I
   didn't have to include the ? ? tags? Obviously I was wrong...
 
  You don't need to close the PHP context with ?
 
  PHP does it for you when it hits the end of the file... this is a
  feature.
 
  Cheers,
  Rob.

 Yes, it does, but well, doesn't it look nice an ending ? ??

Mostly, it looks like a dangling piece of rubbish. I never add the
closing ? on a source-only file. And since I never mix code with
content... I never see ? in my files *grin*.

The code generated by the template compiler has the appropriate closing
tags though... and of course since it's generated, it's a run-time soup
of HTML and embedded PHP code :)

Cheers,
Rob.


Mostly for the very basic sites, I put HTML code at the end of my
file, so i don't have to echo it and think about quotes. And a lot of
times, i also have HTML in front of my code, or when using sessions,
in between like this:
?php
session_start();
?
htmlheadtitleTest/title/headbody
?php
// Some PHP code here
?
/body/html

And then, the ? is a must :)

Tijnema

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



Re: [PHP] Include files beneath pointed directory

2007-01-18 Thread Chris

Wikus Moller wrote:

Hi.

I have a windows server and I know this issue has been dealt with
before but I can't find it, I want to include a file from a directory
beneath or aside my home directory.

Can I use the C:\directory\anotherdirectory\file.php in the include
function like include C:\directory\anotherdirectory\file.php; or do
I need more code to make it work? I am sure I do. The directory would
be aside my home directory.


That should work fine in theory.

I'd suggest using the constant 'DIRECTORY_SEPARATOR' instead:

$path = 'c:' . DIRECTORY_SEPARATOR . 'directory' .

so you don't have to worry about escaping backslashes, otherwise you 
have to write it as:


c:\\directory\\ ...

or

c:/directory/

Both of those should work ok but using the constant you shouldn't have 
any problems with forgetting about escaping a \ .


--
Postgresql  php tutorials
http://www.designmagick.com/

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



RE: [PHP] include files, .php or .inc ?

2004-11-22 Thread steve
Graham Cossey wrote:
 If you only have limited control/knowledge of Apache you could adopt
 names something like: script.inc.php
 
 In such a way PHP will always process the script as it's extension
 is .php and you can easily identify that it is a script to be
 included/required.

FWIW, I use .php for main scripts/pages, and .phtml for includes, as the
latter get processed through PHP too.

-- 
@+
Steve

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



Re: [PHP] include files, .php or .inc ?

2004-11-22 Thread Marek Kilimajer
Richard Davey wrote:
Hello Perry,
Sunday, November 21, 2004, 8:02:48 PM, you wrote:
PJ What it the purpose of the .inc file then?
Security - on a properly configured web server a .inc file will never
actually try and compile/execute itself. Whereas a .php one always
will.
Yes, .inc files will show up as they are - php source, db 
username/password etc. So it's even less secure unless you forbid 
serving them:

Files *.inc
Order Allow,Deny
Deny from all
/Files
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] include files, .php or .inc ?

2004-11-22 Thread Justin French
On 22/11/2004, at 7:02 AM, Perry Jönsson wrote:
What it the purpose of the .inc file then?
It gives you a way of knowing what's a directly executable file (like 
index.php) and what's an included file.  Further, I disallow the direct 
serving of all .inc files in my htaccess, so that people can't directly 
browse an include file which should not be executed on their own, and 
should not be served to a browser direct as text (like passwords).

Better still, store all your includes outside the document root, but 
that's another story.

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


Re: [PHP] include files, .php or .inc ?

2004-11-21 Thread Jon-Eirik Pettersen
Perry Jönsson wrote:
Hello,
Does it make any difference if you include 
(include/require/include_once/require_once) files with extension 
.inc or .php?
No, it does not.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] include files, .php or .inc ?

2004-11-21 Thread Perry Jönsson
Jon-Eirik Pettersen wrote:
Perry Jönsson wrote:
Hello,
Does it make any difference if you include 
(include/require/include_once/require_once) files with extension 
.inc or .php?

No, it does not.

What it the purpose of the .inc file then?
/Perry
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] include files, .php or .inc ?

2004-11-21 Thread Jon-Eirik Pettersen
Perry Jönsson wrote:
Jon-Eirik Pettersen wrote:
Perry Jönsson wrote:
Hello,
Does it make any difference if you include 
(include/require/include_once/require_once) files with extension 
.inc or .php?

No, it does not.

What it the purpose of the .inc file then?
Not really anything. Just to separate the files. A problem when using 
.inc files
is that it is not default parsed when requested directly in the browser, 
so it
may be less secure if it contain SQL-passwords, etc.

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


Re: [PHP] include files, .php or .inc ?

2004-11-21 Thread Janet Valade
Perry Jönsson wrote:
Jon-Eirik Pettersen wrote:
Perry Jönsson wrote:
Hello,
Does it make any difference if you include 
(include/require/include_once/require_once) files with extension 
.inc or .php?

No, it does not.

What it the purpose of the .inc file then?
For organization. The file name shows what the file is, without having 
to look at the contents of any scripts.

Janet
/Perry

--
Janet Valade -- janet.valade.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] include files, .php or .inc ?

2004-11-21 Thread Graham Cossey
 Perry Jönsson wrote:

  Jon-Eirik Pettersen wrote:
 
  Perry Jönsson wrote:
 
  Hello,
 
  Does it make any difference if you include
  (include/require/include_once/require_once) files with extension
  .inc or .php?
 
 
 
  No, it does not.
 
 
 
  What it the purpose of the .inc file then?

 For organization. The file name shows what the file is, without having
 to look at the contents of any scripts.


If you only have limited control/knowledge of Apache you could adopt
names something like: script.inc.php

In such a way PHP will always process the script as it's extension
is .php and you can easily identify that it is a script to be
included/required.

Graham

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



Re: [PHP] include files, .php or .inc ?

2004-11-21 Thread John Holmes
Perry Jnsson wrote:
Does it make any difference if you include 
(include/require/include_once/require_once) files with extension .inc 
or .php?
It makes no difference as far as PHP is concerned. You're just telling 
PHP what file to load.

However, .inc files are generally served up as plain text if requested 
on their own. This means that anyone can view the PHP code (and possibly 
passwords?) they contain.

So many people will just name them with a .php extension so nothing is 
returned to the user. This has it's own set of problems because now the 
files can be run out of context. Depending on your application, this 
could be a big issue; what if they could bypass your security measures 
by requesting files on their own?

This is a fairly frequently asked question and the number one suggestion 
is always to place the files outside of your web root so they can not be 
requested through a browser at all. PHP can still include them, you just 
have to provide the correct path. Then you can give them any extension 
you want.

This isn't always possible or ideal, though and then you have to resort 
to either naming them with .php extensions (and being aware of the issue 
discussed above) or relying on an .htaccess file to deny access to any 
.inc files (so people cannot view/run them out of context). .htaccess is 
not an entirely portable solution, though, so you have to take that into 
consideration also.

Good luck with your decision. I personally use .inc.php (for visual 
reference of which ones are include files) and stay aware of what could 
happen if these files are run out of context.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] include files

2003-12-20 Thread Todd
This looks like it should do exactly what I need. Thanks for pointing that
out.

Marek Kilimajer wrote:
 See function debug_backtrace(), it's available since 4.3.3


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



RE: [PHP] include files

2003-12-19 Thread Chris W. Parker
Todd mailto:[EMAIL PROTECTED]
on Thursday, December 18, 2003 9:57 AM said:

 Is it possible under PHP4 to get the name of the file that a function
 was called from? To clarify, here's an example of what I'd like to do:

[snip]

 Does anyone know of a way to do this? I've tried several different
 things, including to constant '__FILE__ ', but they all return the
 current file, I am needing the included filename.

yes this would be very handy for error reporting purposes but alas it is
not to be. afaik there is no way to do what you want save passing
__FILE__ to the function...


functio foo($stuff, $more_stuff, $current_file)
{
... do stuff ...
}


?php

echo foo($thing, $other_thing, __FILE__);


?

that's what i ended up doing.




chris.
--
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/

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



Re: [PHP] include files

2003-12-19 Thread Marek Kilimajer
See function debug_backtrace(), it's available since 4.3.3

Todd wrote:
Hi,

Is it possible under PHP4 to get the name of the file that a function was
called from? To clarify, here's an example of what I'd like to do:
--- main.php ---
?php
   include('include.php');
   function foo(){
  $include_file=file_that_called_foo();
  printf($include_file);
   }
?
   
--- include.php ---
?php
   foo();
?

Does anyone know of a way to do this? I've tried several different things,
including to constant '__FILE__ ', but they all return the current file, I
am needing the included filename.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Include files

2003-02-26 Thread Ernest E Vogelsinger
At 01:34 26.02.2003, Kenneth Suralta said:
[snip]
How do I include external library files in PHP???
I would like to put the lines that are repeated in each php files, in a 
separate file.
e.g.
?php
$db_host = localhost;
$db_port = 3306;
$db_name = test;
...
?
[snip] 

Haven't I heard that before?
http://www.php.net/manual/en/function.include.php


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



Re: [PHP] Include files

2003-02-26 Thread David Eisenhart
if require is used to include the 'same file', say, twice that file will be
loaded twice. This can of course cause errors (such as resulting from the
redefinition of functions within this file). In contrast the require_once
construct will only load a file 'once' irrespective of the number of times
it is subsequently called to do so (thereby preventing such errors arising).

I would imagine (but am not certain) that there may be a slight speed
penalty in using require_once as opposed to require.

David


Jinky Otacan Cocalon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 the problem was solved by creating an include file and using using
 require() method

 i was just wondering what are the advantages and disadvantages of using
 require_once() instead of require()?

 thanx =)




 John W. Holmes wrote:
 How do I include external library files in PHP???
 I would like to put the lines that are repeated in each php files, in
 
  a
 
 separate file.
 e.g.
 ?php
 $db_host = localhost;
 $db_port = 3306;
 $db_name = test;
 ...
 ?
 
 
  Just throw caution to the wind and try the include() function I'm
  not responsible for the consequences!!! Do not blame me if your file is
  included!!
 
  ---John W. Holmes...
 
  PHP Architect - A monthly magazine for PHP Professionals. Get your copy
  today. http://www.phparch.com/
 
 
 

 --

 Gravity can't be held responsible for people falling in love.




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



RE: [PHP] Include files

2003-02-25 Thread John W. Holmes
 How do I include external library files in PHP???
 I would like to put the lines that are repeated in each php files, in
a
 separate file.
 e.g.
 ?php
 $db_host = localhost;
 $db_port = 3306;
 $db_name = test;
 ...
 ?

Just throw caution to the wind and try the include() function I'm
not responsible for the consequences!!! Do not blame me if your file is
included!!

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



Re: [PHP] Include files

2003-02-25 Thread Larry E. Ullman
How do I include external library files in PHP???
I would like to put the lines that are repeated in each php files, in 
a separate file.
e.g.
?php
$db_host = localhost;
$db_port = 3306;
$db_name = test;
...
?
I find the include() function to be quite useful for including external 
files. Check out the relevant pages of the PHP Manual:
www.php.net/include
and
www.php.net/include_once
and
www.php.net/require
and
www.php.net/require_once

Larry

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


RE: [PHP] Include files

2003-02-25 Thread Bryan Lipscy
Funny thing about online manuals.

include() http://www.php.net/manual/en/function.include.php
include_once() http://www.php.net/manual/en/function.include-once.php

Please read: http://www.catb.org/~esr/faqs/smart-questions.html


-Original Message-
From: Kenneth Suralta [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 25, 2003 4:35 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Include files


How do I include external library files in PHP???
I would like to put the lines that are repeated in each php files, in a 
separate file.
e.g.
?php
$db_host = localhost;
$db_port = 3306;
$db_name = test;
...
?

Kenneth



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

2003-02-25 Thread Jinky Otacan Cocalon
the problem was solved by creating an include file and using using 
require() method

i was just wondering what are the advantages and disadvantages of using 
require_once() instead of require()?

thanx =)



John W. Holmes wrote:
How do I include external library files in PHP???
I would like to put the lines that are repeated in each php files, in
a

separate file.
e.g.
?php
$db_host = localhost;
$db_port = 3306;
$db_name = test;
...
?


Just throw caution to the wind and try the include() function I'm
not responsible for the consequences!!! Do not blame me if your file is
included!!
---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/


--

Gravity can't be held responsible for people falling in love.

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


Re: [PHP] include files and global variables

2002-07-21 Thread Michael Hall


I think that you need to call the checkMaster() function AFTER you declare
it, not before. Try moving checkMaster(); beneath the function
definition.

Mick


On Sun, 21 Jul 2002, Jon Wyatt wrote:

 
 I have some pages which include a number of files.
 In one of the include files I have a function which I wish to be executed 
 everytime the include file is loaded.
 
 Therefore I place the function name in the include file at the top.
 
 However, this function uses a session variable to decide whether to call 
 another function and it appears that this variable is not being carried 
 across. For example, the start of the include file might look like this:-
 
 
 ?php
 
 checkMaster();
 
 
 function checkMaster()
 {
 global $master_session;
 if ($master_session[db_host])
 {
 connectToDB();
 }
 }
 
 
 function connectToDB()
 {
   ...
   
 
 
 The master_session variable is not set and hence connectToDB is never 
 called.
 If I place the checkMaster code in each page that includes this file then it 
 all works fine. How do I get round this?
 
 Thanks.
 
 jon.
 
 Better than having your body rubbed vigorously with a cheese grater.
 http://www.samuri.co.uk.
 
 
 _
 MSN Photos is the easiest way to share and print your photos: 
 http://photos.msn.com/support/worldwide.aspx
 
 
 

-- 

n   i   n   t   i  .   c   o   m
php-python-perl-mysql-postgresql

Michael Hall [EMAIL PROTECTED]



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




RE: [PHP] include files or fopen

2002-06-30 Thread David Freeman


  I am trying to write a program that is very modular in 
  nature  one of the
  features I need the user to be able to do is install/uninstall or
  enable/disable the module though the interface.

I have, in the past, stored such information in a database.  In projects
that have need of such functionality I create a modules table and use
that to store what information I need - normally that's a path to the
module, the name of the config file for that module and any other
relevant bits that the project as a whole needs to know about.

Then when a page loads it can check for any appropriate modules in the
process and deal with them accordingly.

CYA, Dave




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




Re: [PHP] Include Files self aware?

2002-04-30 Thread Billy S Halsey

Try this code (untested):

function selfAwareInclude($filename)
{
define($filename, true);
include($filename);
}

Inside your include file, make calls such as

if (defined($filename)) {
// Do whatever
}

Then use the selfAwareInclude() function instead of include(). You could 
do the same with require, etc.

/bsh/

PHP List wrote:
 Hi,
 Is it possible to detect if a file is being called as an include or require?
 
 ex:
 include(file.php)-- file.php code can detect that is has been
 called as an include.
 
 Thanks,
 Chris
 
 


-- 


/-=[ BILLY S HALSEY ]=--\
| Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW  |
| All opinions and technical advice offered in this message are my |
| own and not necessarily endorsed by my employer. |
\--=[ [EMAIL PROTECTED] ]=/


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




Re: [PHP] Include Files self aware?

2002-04-30 Thread mArk.cOLListER


The problem with this is you will loose the scope of your variables.

So $filename will not have access to anything from where the function is
called...

-mark

On Tue, 30 Apr 2002, Billy S Halsey wrote:

 Try this code (untested):

 function selfAwareInclude($filename)
 {
 define($filename, true);
 include($filename);
 }

 Inside your include file, make calls such as

 if (defined($filename)) {
 // Do whatever
 }

 Then use the selfAwareInclude() function instead of include(). You could
 do the same with require, etc.

 /bsh/

 PHP List wrote:
  Hi,
  Is it possible to detect if a file is being called as an include or require?
 
  ex:
  include(file.php)-- file.php code can detect that is has been
  called as an include.
 
  Thanks,
  Chris
 
 


 --


 /-=[ BILLY S HALSEY ]=--\
 | Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW  |
 | All opinions and technical advice offered in this message are my |
 | own and not necessarily endorsed by my employer. |
 \--=[ [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 Files self aware?

2002-04-30 Thread Miguel Cruz

On Tue, 30 Apr 2002, PHP List wrote:
 Is it possible to detect if a file is being called as an include or require?
 
 ex:
 include(file.php)-- file.php code can detect that is has been
 called as an include.

Compare $PHP_SELF with __FILE__, maybe?

miguel


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




RE: [PHP] Include Files self aware?

2002-04-30 Thread Maxim Maletsky \(PHPBeginner.com\)

// In your config file:

function selfAwareInclude($filename) {
define($filename, true);
}



// in the file you are making an include

selfAwareInclude($filename)
include($filename);




Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins



 -Original Message-
 From: mArk.cOLListER [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 01, 2002 2:00 AM
 To: php
 Subject: Re: [PHP] Include Files self aware?
 
 
 The problem with this is you will loose the scope of your variables.
 
 So $filename will not have access to anything from where the function
is
 called...
 
   -mark
 
 On Tue, 30 Apr 2002, Billy S Halsey wrote:
 
  Try this code (untested):
 
  function selfAwareInclude($filename)
  {
  define($filename, true);
  include($filename);
  }
 
  Inside your include file, make calls such as
 
  if (defined($filename)) {
  // Do whatever
  }
 
  Then use the selfAwareInclude() function instead of include(). You
could
  do the same with require, etc.
 
  /bsh/
 
  PHP List wrote:
   Hi,
   Is it possible to detect if a file is being called as an include
or require?
  
   ex:
   include(file.php)-- file.php code can detect that is has
been
   called as an include.
  
   Thanks,
   Chris
  
  
 
 
  --
 
 
  /-=[ BILLY S HALSEY
]=--\
  | Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW
|
  | All opinions and technical advice offered in this message are my
|
  | own and not necessarily endorsed by my employer.
|
  \--=[ [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 files with PHP 3.0.16

2001-04-16 Thread James Atkinson

 Is there an equivalent to !--#include file="filename.inc"-- in 
 PHP?  And 
 will it work in version 3.0.16.  I've gone through the online manual but 
 found nothing that would help in this situation.

include("filename.inc");

or

require("filename.inc");

http://www.php.net/include
http://www.php.net/require

Enjoy,

James 'theFinn' Atkinson
http://www.phpbb.com

-- 
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 files with PHP 3.0.16

2001-04-16 Thread CC Zona

In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Tim Thorburn) wrote:

 Is there an equivalent to !--#include file="filename.inc"-- in PHP?  And 
 will it work in version 3.0.16.  I've gone through the online manual but 
 found nothing that would help in this situation.

http://php.net/manual/en/function.virtual.php

-- 
CC

-- 
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 files with PHP 3.0.16

2001-04-16 Thread Stefan Kostopoulos

Tim,

Check out the include() and require() function of php.

Stefan

-Original Message-
From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 16, 2001 5:38 PM
To: [EMAIL PROTECTED]
Subject: [PHP] include files with PHP 3.0.16


Hi,

I'm currently working on a rather large site and have just completed the 
navigation portion of it.  I'd like to make use of server side includes so 
that if I have to make changes down the road, I won't have to chance 
potentially 100s of files.  Normally I use !--#include 
file="filename.inc"-- with .asp and .shtml files, however, this does not 
seem to work for me using PHP 3.0.16 (the version my web host uses).

Is there an equivalent to !--#include file="filename.inc"-- in PHP?  And 
will it work in version 3.0.16.  I've gone through the online manual but 
found nothing that would help in this situation.

Thanks
-Tim


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

2001-04-04 Thread bizzk

html
head
title/title
/head

body

...your HTML page...

br

?

include("footer.html");

?

/body
/html

I got this from www.devshed.com
(http://www.devshed.com/Server_Side/PHP/PHP101_1/page5.html). Check it out!

See You, Bizzk


""Mike"" [EMAIL PROTECTED] schreef in bericht
9afcj1$o9l$[EMAIL PROTECTED]">news:9afcj1$o9l$[EMAIL PROTECTED]...
 I'm trying to use html "include" syntax in a php page.If I use .shtml the
 php gets ignored .If I use php the !--#include virtual="Nav.htm" -- the
 php gets ignored.Is there a way of doing this without using the php
include
 function?
 Thanks

 Mike P
 [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]




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

2001-04-04 Thread Boget, Chris

 I'm trying to use html "include" syntax in a php page.If I 
 use .shtml the php gets ignored .If I use php the !--#include 
 virtual="Nav.htm" -- the php gets ignored.Is there a way 
 of doing this without using the php include function?

Set up the .shtml extension so that it is parsed as PHP.

Chris



Re: [PHP] Include Files

2001-04-04 Thread Christian Reiniger

On Wednesday 04 April 2001 17:08, you wrote:
 I'm trying to use html "include" syntax in a php page.If I use .shtml
 the php gets ignored .If I use php the !--#include virtual="Nav.htm"
 -- the php gets ignored.Is there a way of doing this without using the
 php include function?
 Thanks

Stop resubmitting this every few minutes!


 Mike P
 [EMAIL PROTECTED]

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Software is like sex: the best is for free" -- Linus Torvalds

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

2001-04-04 Thread CC Zona

In article 9afah8$8d3$[EMAIL PROTECTED],
 [EMAIL PROTECTED] ("Mike") wrote:

 I'm trying to use html "include" syntax in a php page.If I use .shtml the
 php gets ignored .If I use php the !--#include virtual="Nav.htm" -- the
 php gets ignored.Is there a way of doing this without using the php include
 function?

http://www.php.net/virtual/

-- 
CC

-- 
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 files????

2001-04-02 Thread Felix Kronlage

On Mon, Apr 02, 2001 at 08:55:26AM -0300, Bruno Freire wrote:

 Anybody can tell me how can i do Include files?

has the thought of looking up the manual at php.net crossed your mind?
try searching php.net for include(), require()

-fkr
-- 
gpg-fingerprint: 076E 1E87 3E05 1C7F B1A0  8A48 0D31 9BD3 D9AC 74D0 
  |http://www.hazardous.org/ | whois -h whois.ripe.de FKR-RIPE  |
  |all your base are belong to us  |  shame on me  | fkr@IRCnet | 


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

2001-02-12 Thread Alexander Wagner

Conover, Ryan wrote:
 I have an include file foo.inc.  I want to call a function that is in
 another include file,say anotherfoo.inc, from the foo.inc.

[..]

 can I call an include from another include?

Sure.

 I tried the above but it fails opening the other include.

 Should I have the
 '  "include"c:\\...\\anotherfoo.inc"  '
 in the file that includes the Foo.inc?

No, you can include what and where you want (provided it's valid PHP), 
but if you use relative paths, the paths all have to be relativ to the 
original file, the file that is called by the browser (or whatever you 
use to call your scripts).

regards
Wagner

-- 
Three may keep a secret, if two of them are dead.

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

2001-02-12 Thread PHPBeginner.com

Yes, you can include foo.php which has another include in it and another and
another    they will all appear to you as a one single file.

But, be careful though, do not reinclude them, or you'll create an infinite
loop.. use include_once instead


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-Original Message-
From: Conover, Ryan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 1:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Include files


I have an include file foo.inc.  I want to call a function that is in
another include file,say anotherfoo.inc, from the foo.inc.

//Foo.inc

include "c:\\...\\anotherfoo.inc";

//other code

//end of include

can I call an include from another include?

I tried the above but it fails opening the other include.

Should I have the
'  "include"c:\\...\\anotherfoo.inc"  '
in the file that includes the Foo.inc?

ryan

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

2001-02-05 Thread Steve Werby

"David VanHorn" [EMAIL PROTECTED] wrote:
 I know this works, in footer.inc, to pull up nomenu.
 ? include("/home/dvh/public_html/footer-nomenu.inc")?

 However, is there a more "generic" way to specify the server root as the
path?
 I'd rather not expose my directory structure in the PHP code.

How about the environment variable $DOCUMENT_ROOT (you may need to access as
$GLOBALS[DOCUMENT_ROOT] depending on your code).  Put ?php phpinfo(); ? in
a webpage to see all of the goodies available to you.  I personally prefer
to keep the bulk of my PHP code outside the document root, in a directory
parallel to it.  I define a constant INC_PATH typically parallel to the
document root using code similar to the following:

// Set INC_PATH.
ereg( "(.*)web_directory.*", $SCRIPT_FILENAME, $regs );
define( "INC_PATH", $regs[1] . "inc_directory/" );

Then I include files as follows:

include( INC_PATH . "inc_common.php" );

Very portable.

 I tried various versions of ../ and ../../ without success.

This isn't very portable anyway.  You don't want to have to change paths if
you move a file to a deeper subdirectory.

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/


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

2001-02-05 Thread Brian V Bonini

DOCUMENT_ROOT  ???
http://php.net/manual/en/language.variables.predefined.php


 -Original Message-
 From: David VanHorn [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 05, 2001 12:16 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] include files


 I've got kind of a deep page structure, lots of subdirs.
 I'm having trouble with an include directive.
 The problem is a footer that I use on all pages, which resides in the base
 directory.

 The footer file includes another file, which I use if there is no menu.
 footer.inc has menu, and includes footer-nomenu.inc
 footer-nomenu.inc may be used alone.

 I know this works, in footer.inc, to pull up nomenu.
 ? include("/home/dvh/public_html/footer-nomenu.inc")?

 However, is there a more "generic" way to specify the server root
 as the path?
 I'd rather not expose my directory structure in the PHP code.
 I tried various versions of ../ and ../../ without success.
 --
 Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9



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

2001-02-05 Thread David VanHorn

At 12:50 PM 2/5/01 -0500, Brian V Bonini wrote:
DOCUMENT_ROOT  ???
http://php.net/manual/en/language.variables.predefined.php

Ok, but having read the docs you pointed to (thanks), I still don't see how 
to use it in an include directive.

I assume that since the vhost is specified to use "/home/dvh/public_html/" 
as the server root, that DOCUMENT_ROOT is equal to "/home/dvh/public_html/" 
when the server is  running any script from that vhost.

But, how do I apply that to the include directive?

? include("/home/dvh/public_html/footer-nomenu.inc")?

--
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9



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

2001-02-05 Thread Brian V Bonini

?
include ($DOCUMENT_ROOT . "/footer-nomenu.inc");
?

 -Original Message-
 From: David VanHorn [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 05, 2001 1:04 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: RE: [PHP] include files
 
 
 At 12:50 PM 2/5/01 -0500, Brian V Bonini wrote:
 DOCUMENT_ROOT  ???
 http://php.net/manual/en/language.variables.predefined.php
 
 Ok, but having read the docs you pointed to (thanks), I still 
 don't see how 
 to use it in an include directive.
 
 I assume that since the vhost is specified to use 
 "/home/dvh/public_html/" 
 as the server root, that DOCUMENT_ROOT is equal to 
 "/home/dvh/public_html/" 
 when the server is  running any script from that vhost.
 
 But, how do I apply that to the include directive?
 
 ? include("/home/dvh/public_html/footer-nomenu.inc")?
 
 --
 Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9
 
 
 

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

2001-02-05 Thread Christian Reiniger

On Monday 05 February 2001 18:15, David VanHorn wrote:

 I know this works, in footer.inc, to pull up nomenu.
 ? include("/home/dvh/public_html/footer-nomenu.inc")?

 However, is there a more "generic" way to specify the server root as
 the path? I'd rather not expose my directory structure in the PHP code.
 I tried various versions of ../ and ../../ without success.

Set the include_patz in php.ini and include everything relative to that 
path

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

(A)bort (R)etry (P)retend this never happened ...

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