Again, thank you for everyone that offered their advice.
Gary gwp...@ptd.net wrote in message
news:8a.64.51087.33bf3...@pb1.pair.com...
I'm working on learning php and have been toying with includes, and I am
trying to figure the advantages/disadvantages to using them.
I know that using
Again, thank you for everyone that offered their advice.
Gary gwp...@ptd.net wrote in message
news:8a.64.51087.33bf3...@pb1.pair.com...
I'm working on learning php and have been toying with includes, and I am
trying to figure the advantages/disadvantages to using them.
I know that using
-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
Sent: 09 March 2009 19:55
To: Mayer, Jonathan
Cc: Gary; php-general@lists.php.net
Subject: RE: [PHP] Re: PHP includes
On Mon, 2009-03-09 at 15:10 +, Mayer, Jonathan wrote:
Thank you to everybody
Mayer, Jonathan wrote:
Just thought I'd point out that it's recommended against giving non-php
extensions to PHP code pages. Basically, making all of your include
files .inc without the server correctly configured to recognise all .inc
files as PHP files, you are opening yourself up to
Thank you to everybody that replied...but it almost seems it is making extra
work.
I can understand using an include for a menu, since they tend to change
often and it is on every page, but the normal content I am not understanding
the benefit. If I have a page that has unique content on it,
Thank you to everybody that replied...but it almost seems it is making
extra
work.
I can understand using an include for a menu, since they tend to change
often and it is on every page, but the normal content I am not
understanding
the benefit. If I have a page that has unique content on it,
From: Gary
Thank you to everybody that replied...but it almost seems it is making
extra
work.
I can understand using an include for a menu, since they tend to
change
often and it is on every page, but the normal content I am not
understanding
the benefit. If I have a page that has
Gary wrote:
Thank you to everybody that replied...but it almost seems it is making extra
work.
I can understand using an include for a menu, since they tend to change
often and it is on every page, but the normal content I am not understanding
the benefit. If I have a page that has unique
Gary wrote:
Thank you to everybody that replied...but it almost seems it is making extra
work.
I can understand using an include for a menu, since they tend to change
often and it is on every page, but the normal content I am not understanding
the benefit. If I have a page that has unique
Gary wrote:
Thank you to everybody that replied...but it almost seems it is making extra
work.
What is the best type of file to be used as an include (.txt, .php).
new I forgot something! the best type of file to be used as an include
differs on a case by case basis.
name the files
On Mon, 2009-03-09 at 15:10 +, Mayer, Jonathan wrote:
Thank you to everybody that replied...but it almost seems it is making
extra
work.
I can understand using an include for a menu, since they tend to change
often and it is on every page, but the normal content I am not
Ashley Sheridan wrote:
Just thought I'd point out that it's recommended against giving non-php
extensions to PHP code pages. Basically, making all of your include
files .inc without the server correctly configured to recognise all .inc
files as PHP files, you are opening yourself up to possible
On Monday 09 March 2009 3:07:17 pm Nathan Rixham wrote:
Ashley Sheridan wrote:
Just thought I'd point out that it's recommended against giving non-php
extensions to PHP code pages. Basically, making all of your include
files .inc without the server correctly configured to recognise all .inc
On Mon, 2009-03-09 at 15:23 -0500, Larry Garfield wrote:
On Monday 09 March 2009 3:07:17 pm Nathan Rixham wrote:
Ashley Sheridan wrote:
Just thought I'd point out that it's recommended against giving non-php
extensions to PHP code pages. Basically, making all of your include
files .inc
On Mon, Feb 2, 2009 at 6:42 AM, Edmund Hertle farn...@googlemail.com wrote:
Hey,
normally I prefer to do all my includes (classes + config files) at the
beginning if my php files. But recently I thought about including some
classes only if they are needed later in my code (like pear Mail and
Hi,
Mail_mime
Ooh...
only if an e-mail is about to be sent) because of speed issues. So
my question: Is this something I should consider? Or is it something I
normally will not notice?
Depends on the load on your server. If you're getting a billion
requests per second, then it may well be
David,
Thank you for responding.
__autoload
... which basically only loads classes when they are required.
Yes, this is exactly what I needed. Not only was I already on PHP5, but
fortunately I had also already been building my classes so that it was
one class per file, as __autoload
Hi Dave,
PHP general list,
This is probably obvious to people who are good at PHP, but I'm
I have a PHP based CMS (content management system) built, which has
grown and become quite robust. It's now spread out over about 30 files,
and each file represents one class within the object
Dave M G wrote:
Currently, my processes are taking under a second, but they can be
around half a second or more. Although it all happens too fast for me to
really notice as a person, it seems to me that a half second of
processing time might be kind of long and lead to scalability problems.
On Tuesday 31 July 2007, Dave M G wrote:
PHP general list,
This is probably obvious to people who are good at PHP, but I'm
I have a PHP based CMS (content management system) built, which has
grown and become quite robust. It's now spread out over about 30 files,
and each file represents one
A couple of things.
1) Delay your output to the very end. That way you can still do page
redirects and build whole new pages depending on the errors you get.
2) Store errors in the session, then when building the page have a place
for put any error messages here, then delete them from the
On Fri, April 28, 2006 3:09 am, Nick Wilson wrote:
[EMAIL PROTECTED] ls
ads/ config.inc db.inc funcs.inc init.inc
where ads/ is a whole huge set of scripts from an existing setup. ads/
was originally placed on its own domain as it's a version of phpadsnew
and runs as a server all by
Nick Wilson wrote:
Hello all,
Im having some problems understanding why some requires() are failing.
Let me see if i can describe what's going on clearly...
I have this:
[EMAIL PROTECTED] ls
ads/ config.inc db.inc funcs.inc init.inc
where ads/ is a whole huge set of scripts from an
* and then Jochem Maas declared
Nick Wilson wrote:
Hello all, Im having some problems understanding why some requires() are
failing.
Let me see if i can describe what's going on clearly...
I have this:
[EMAIL PROTECTED] ls
ads/ config.inc db.inc funcs.inc init.inc
where ads/ is
Nick Wilson wrote:
* and then Jochem Maas declared
Nick Wilson wrote:
...
use something *like* the following:
$oldincpath = ini_get('include_path');
ini_set('include_path', 'path/to/ads/stuff:etc');
// do your 'ads' requires
ini_set('include_path', $oldincpath);
Unfortunately
* and then Jochem Maas declared
check directory permission, check the include_path is being set,
check the include path is actually correct (I take it you have a good
understanding how include_path works).
Good call on dir perms, but yes, they appear to be fine. I *think* i
have a good
dirs named in include_path should not have a slash at the end. and don't forget
to
include the DOT as one of your include pathes e.g.
ini_set('include_path', '.:/the/rest');
can you send the list of requires you do [again] (and state where the files
are actually living on disk) - I'm on 3
I think you can do this:
../tmpl/header.htm
try it and let us know!!
hope this helps
Angelo
-Original Message-
From: Will [mailto:[EMAIL PROTECTED]
Sent: Monday, April 05, 2004 4:48 PM
To: [EMAIL PROTECTED]
Subject: [PHP] includes
Hello all,
I have a problem. My directory list is
If I think I understand you, your 'root' directory is the 'forums' directory,
and you'll probably want to do something like:
include($_SERVER[DOCUMENT_ROOT] . /../inc/include1.php);
The double-dots take you back a directory.
Is that what you're after?!
Richard
-Original Message-
At 16:47 5-4-04, you wrote:
Hello all,
I have a problem. My directory list is similar to this:
root
tmpl
inc
forums
test_forum
messages
test_forum1
.messages
My question is in the test_form and message forums. How do I do the include
files to
I had some similar problems ! Here's what I did.
include $_SERVER['DOCUMENT_ROOT'] . '/includes/_myInclude.php' ;
Putting the DOCUMENT_ROOT ensured I was always pointing to the top
directory of the web pages.
Daniel Clark
I have a problem. My directory list is similar to this:
root
Monday, April 5, 2004, 4:47:52 PM, you wrote:
Hello all,
I have a problem. My directory list is similar to this:
root
tmpl
inc
forums
snipped
My question is in the test_form and message forums. How do I do the include
files to read from the tmpl and inc??
I can get the
On 15 January 2004 22:39, Luke wrote:
? Holy cow, this gets simpler all the time. Pretty soon, there'll be
? nothing left on my page but PHP includes and echo functions! ?
? Does this cut down on a website's file size? In other
words, are the php
? includes effectively inactive when no one's
On 16 January 2004 00:30, Freedomware wrote:
I should have played with this some more before I posted more
questions. After fixing an error on the included page, I replaced
every instance of na/a1 on both pages with a1. That seemed to fix
everything; the first style sheet comes through, but
Thanks for all the tips. It's getting generally getting clearer, but I'm
a little confused somewhere.
Can I give you a better explanation of what I'm trying to do, along with
my latest code?
The pages on this site focus on various nations and states, with lots of
links like this:
[LOCAL]
On 16 January 2004 13:54, Freedomware wrote:
Thanks for all the tips. It's getting generally getting
clearer, but I'm
a little confused somewhere.
[SNIP]
I inserted one of the functions you suggested - $includea1 = TRUE; -
after the include, but I'm sure I did it wrong.
Just like before
hi
Very simple problems, good to see ur getting the hang of it :)
the first is, you have defined your variables after you include the page, so
that the echo is outputting a blank variable...
so instead of:
?php include (../../../../includes/state/head.php); ?
meta name=mssmarttagspreventparsing
i just changed the opening and closing tags a little (you didnt need so
many) but the main change is, now the variables come before the included
file, so that the include file can access those variables too.
Holy cow, this gets simpler all the time. Pretty soon, there'll be
nothing left on my
? Holy cow, this gets simpler all the time. Pretty soon, there'll be
? nothing left on my page but PHP includes and echo functions!
?
? Does this cut down on a website's file size? In other words, are the php
? includes effectively inactive when no one's viewing your main pages,
? leaving them
I wrote:
? But suppose there's a certain page where I don't want the style sheet in
? the middle - the one I named MIDDLE. Is there a way to mark it in the
? include page, then instruct the main page to either not import it or
? replace it with nothing ()?
Luke wrote:
youd have to use a
Oops, I spotted some big errors in my included page already. Here's the
new page:
?php
$todayDate = date(m-d-Y);
echo 'titleFreedomware gt; $statename/title';
echo 'meta name=description content=ZXZX versus Microsoft /';
echo 'script src=' . $periods . 'js/swapclass.js
I should have played with this some more before I posted more questions.
After fixing an error on the included page, I replaced every instance of
na/a1 on both pages with a1. That seemed to fix everything; the first
style sheet comes through, but the second one is blocked - and I don't
see any
Sheez, I spotted my error regarding $statename. I changed it to the
following, and it fixed that problem.
?php
$todayDate = date(m-d-Y);
echo 'titleFreedomware gt; ' . $statename . '/title';
echo 'meta name=description content=ZXZX versus Microsoft /';
echo 'script src=' . $periods .
To call the file from anywhere within the document space, try this:
include($_SERVER[DOCUMENT_ROOT]./common/setup.inc);
Jim
- Original Message -
From: Robbert van Andel [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, December 21, 2003 1:41 AM
Subject: [PHP] Includes inside
That means the current directory
Cheers,
Marco
--
php|architect - The Magazine for PHP Professionals
Try us free at http://www.phparch.com!
Complete searchable PHP mailing list archives at
http://www.phparch.com/mailinglists
[EMAIL PROTECTED] wrote:
bit of a random thought I need answering
[EMAIL PROTECTED] wrote:
bit of a random thought I need answering really...
when referencing external files, what's the difference between:
../
/
./
I know that ../ means back one directory and jsut a / means look from the
root directory, but what is:
./
???
./ means the current directory.
Oh...
So it's the same as not having any /'s
just the file name?
Marco Tabini [EMAIL PROTECTED]
18/12/2003 14:01
To
[EMAIL PROTECTED]
cc
[EMAIL PROTECTED]
Subject
Re: [PHP] includes...
That means the current directory
Cheers,
Marco
--
php|architect - The Magazine for PHP
in your path.
Best
Bao
Marco Tabini [EMAIL PROTECTED]
18/12/2003 14:01
To
[EMAIL PROTECTED]
cc
[EMAIL PROTECTED]
Subject
Re: [PHP] includes...
That means the current directory
Cheers,
Marco
--
php|architect - The Magazine for PHP Professionals
Try us free at http://www.phparch.com
PHP parses includes inline, so whatever the scope is where the file is
included, is the scope of the variables that the include contains. You can
declare the variables global in your fuction and it will use what was
included, that would be the quick fix, you could also switch your include to
use
At 22:24 04.04.2003, Mike Tuller said:
[snip]
fine except inside functions. So if I have the following:
include /Library/WebServer/includes/database_connection.inc;
function list_search_results()
{
// my code that lists search results
}
The
At 00:26 24.02.2003, Sebastian said:
[snip]
I have a php script with an include(mydomain.com/script.pl); it includes a
bit of perl, but will not include it if I do it using /home/path/ only full
URL, and when i use the full URL it causes one of my other php
Thank you, that worked like a charm :)
I appreciate it.
warm regards,
Sebastian
- Original Message -
From: Ernest E Vogelsinger [EMAIL PROTECTED]
To: Sebastian [EMAIL PROTECTED]
Cc: php list [EMAIL PROTECTED]
Sent: Sunday, February 23, 2003 6:37 PM
Subject: Re: [PHP] includes || perl
I have a php script with an include(mydomain.com/script.pl); it
includes
a
bit of perl, but will not include it if I do it using /home/path/ only
full
URL, and when i use the full URL it causes one of my other php
includes
not
to function correctly.
unfortunately, I do not think
-
From: John W. Holmes [EMAIL PROTECTED]
To: 'Sebastian' [EMAIL PROTECTED]; 'php list'
[EMAIL PROTECTED]
Sent: Sunday, February 23, 2003 10:50 PM
Subject: RE: [PHP] includes || perl
| I have a php script with an include(mydomain.com/script.pl); it
| includes
| a
| bit of perl, but will not include
ah, I didn' see that. Thanks.
warm regards,
Sebastian - [BBR] Gaming Clan
http://www.broadbandreports.com
- Original Message -
From: Leif K-Brooks
To: Sebastian
Sent: Sunday, February 23, 2003 11:17 PM
Subject: Re: [PHP] includes || perl
It is. See also require
Is it not set or is it empty? Try adding this code to menu function
after global $LOCATION;
if(!isset($LOCATION) die('$LOCATION is not set!');
Cesar Aracena wrote:
Hi all,
I'm making a site with a dynamic menu based on IF statements and DB
queries, but have this little problem which I can't
Hi,
The best way to do this (it's only my opinion, I'm sure there are many other
ways but this way works for me) is to create a .php file and fill it with
your most commonly used functions. You can use a .inc file, which is
probably recommended, but you will need to tell the server not to
Yes that is the proper usage.
Maybe you could check the referrer and only display if from the webserver?
I can't remember if a .htaccess would work with that sort of thing, as
password protecting would of course require a password :) Unless this
isn't a public site and you want a password.
Yes, you can use .htacess for that purpose though you don't need to password
protect the folder. I'm sure if you check the archives you'll find a way to
do it.
Something like this: (Thanks to Justin)
http://marc.theaimsgroup.com/?l=php-generalm=103266066416399w=2
- E
On Tuesday, October 8,
The only difference I can think of is that if you included everything at
once, in function or whatever, then that's only 1 file open and read. if
you're doing a bunch of includes all over the place, then your doing more
file open and reads. Not sure if it really affects your script in the grand
Hi
You can do something like this:
ini_set (include_path,ini_get(include_path).:second_include_path);
Tom
At 07:05 AM 10/04/2002, Robert Abbate wrote:
I have a directory with php files that I incorporate into my website as
libraries via a php_include() call, I would like the path to include my
Hi
That goes into each php page. It gets the standard phpinclude directory
then appends your local one using : as the seperator.
It does not affect any other php pages only the one it is used in.
Tom
Where do you place that function call? In the script you're running, or in
the php.ini file?
Hi Sebastian!
Lately I have noticed many scripts that all consist of one
file even though
they create the appearance of many pages. For example, you would open
setup.php and a form would appear. Then after you complete
the form a new
page appears with the results of your form, however
Well, I think I should give a better explanation. I have been
seeing a lot
of scripts that appear to be on multiple pages. For example:
You open file.php, and you are greeted with a form asking
your name. You
give in your name and then submit the form. After you submit
the form you
Assume the following file is named this_script.php:
This is all in ONE file.
?php
if (isset($submit) )
{
print $mytextBR\n;
do some other stuff
exit;
}
?
HTML
HEAD
/HEAD
BODY
FORM method=post action=./this_script.php
INPUT type=text name=mytextBR
INPUT type=submit name=submit
think of an included file as if it were part of the parent code.
so
file1.php
?
echo $foobar;
?
file2.php
?
$foobar = hello world;
include file1.php;
?
file2.php would basically be:
?
$foobar = hello world;
echo $foobar;
?
HTH
Martin
-Original Message-
From: Pax
it must be
something simple..
Paul
-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 26, 2002 5:30 PM
To: 'Pax'; [EMAIL PROTECTED]
Subject: RE: [PHP] includes and variables
think of an included file as if it were part of the parent code.
so
file1
On Tue, 13 Mar 2001 13:45, Rick St Jean wrote:
I am looking for a simple way to include a file and not have it parsed.
But I also do no want to strip out the html and php. Is there a way
to do a nice and simple include and set parsing to false?
Right now I use a fopen and fgets to read from
How embarassing... I read about that and forgot about it.
It is a matter a getting aquainted with new syntax.
Thanks.
Rick
At 01:52 PM 3/13/01 +1030, David Robley wrote:
On Tue, 13 Mar 2001 13:45, Rick St Jean wrote:
I am looking for a simple way to include a file and not have it parsed.
I'm slightly confused as to why you would not want it parsed and
executed...or I should say...what would be the differences in using the
include function vs. reading it in like a file??
Chris
-Original Message-
From: Rick St Jean [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 12, 2001
On Tue, 13 Mar 2001 13:54, Chris Cocuzzo wrote:
I'm slightly confused as to why you would not want it parsed and
executed...or I should say...what would be the differences in using the
include function vs. reading it in like a file??
Chris
-Original Message-
From: Rick St Jean
ubject: Re: [PHP] includes
On Tue, 13 Mar 2001 13:54, Chris Cocuzzo wrote:
I'm slightly confused as to why you would not want it parsed and
executed...or I should say...what would be the differences in using the
include function vs. reading it in like a file??
Chris
-Original Message-
actually what I am doing is creating an area where users can manipulate data
on a page without having harmful code executed. It is faster to use a
flat text file
than a database. I will have these files named something else that will
not be
able to be executed either.
I don't want it
Replace include with include_once where you can.
Best regards,
Andrew
-Original Message-
From: Jens Kisters [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 09, 2001 11:08 AM
To: [EMAIL PROTECTED]
Subject: [PHP] includes slooow
Hi, i just finished my first really big project
we use what could be described as a network of includes in binarycloud, and
have seen very little performance impact, especially given the complexity of
the stuff we're doing.
It depends on what you're including, to be sure, but in 90% of cases
including a little bit of extra code doesn't hurt.
Think of a library:
you make yourself a bunch of files to use somewhere later, and when you need
any of them - include it.
Functions, classes whatever but not IFs and calculation staff: these
would always have to be read...
Cheers!
-Original Message-
From: Dan Phoenix
76 matches
Mail list logo