p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: Storing Functions


Message #1 by Empier4552@a... on Fri, 5 Apr 2002 21:22:46 EST
--part1_12d.f5f34b4.29dfb5f6_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Hey, heres the deal. I'm going to be creating functions for a large site im 
in the process of creating. It'll be various functions some for download, 
user authentication, registration, cookie reading, uploads etc etc. My 
question is how should I store these functions? Should I put them all in an 
include and require it in every page? or should I just individually file 
them? My concern is the size a webpage ends up being if theres too much data 
in the include file.

Message #2 by "Sebastian A." <sebi@x...> on Sat, 6 Apr 2002 08:55:29 +0200
This is a multi-part message in MIME format.

------=_NextPart_000_000E_01C1DD48.CD3D1240
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Will you really be needing the ALL the functions one every page? If I were
you I would group certain functions together (for example all download
functions, all form functions etc.) and just save them as .lib or .inc files
and include only the certain group I need on the specific page. I would also
save all the functions into one file, in case there is a page the requires
many functions..

-----Original Message-----
From: Empier4552@a... [mailto:Empier4552@a...]
Sent: Saturday, April 06, 2002 4:23 AM
To: beginning php
Subject: [beginning_php] Storing Functions

Hey, heres the deal. I'm going to be creating functions for a large site im
in the process of creating. It'll be various functions some for download,
user authentication, registration, cookie reading, uploads etc etc. My
question is how should I store these functions? Should I put them all in an
include and require it in every page? or should I just individually file
them? My concern is the size a webpage ends up being if theres too much data
in the include file. ---


Message #3 by "Gellings, C.O." <gellingsco@p...> on Sat, 6 Apr 2002 22:14:27 +0200
If you store them by type in seperate files you can include them whenever
you want. Your page won't get big, it's only on the server you'll get some
extra code, which you rewuire anyway.

 Best cheers,

Carl
-----Original Message-----
From: Sebastian A. [mailto:sebi@x...]
Sent: 06 April 2002 08:55
To: beginning php
Subject: [beginning_php] RE: Storing Functions


Will you really be needing the ALL the functions one every page? If I were
you I would group certain functions together (for example all download
functions, all form functions etc.) and just save them as .lib or .inc files
and include only the certain group I need on the specific page. I would also
save all the functions into one file, in case there is a page the requires
many functions..

-----Original Message-----
From: Empier4552@a... [mailto:Empier4552@a...]
Sent: Saturday, April 06, 2002 4:23 AM
To: beginning php
Subject: [beginning_php] Storing Functions

Hey, heres the deal. I'm going to be creating functions for a large site im
in the process of creating. It'll be various functions some for download,
user authentication, registration, cookie reading, uploads etc etc. My
question is how should I store these functions? Should I put them all in an
include and require it in every page? or should I just individually file
them? My concern is the size a webpage ends up being if theres too much data
in the include file. ---

Message #4 by Empier4552@a... on Sat, 6 Apr 2002 15:18:23 EST
--part1_6e.1a92954e.29e0b20f_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Thanks for both inputs guys, suggstions were helpful. :-).

In a message dated 4/6/2002 3:16:56 PM Eastern Standard Time, 
gellingsco@p... writes:


> 
> If you store them by type in seperate files you can include them whenever
> you want. Your page won't get big, it's only on the server you'll get some
> extra code, which you rewuire anyway.
> 
> Best cheers,
> 
> Carl
> -----Original Message-----
> From: Sebastian A. [mailto:sebi@x...]
> Sent: 06 April 2002 08:55
> To: beginning php
> Subject: [beginning_php] RE: Storing Functions
> 
> 
> Will you really be needing the ALL the functions one every page? If I were
> you I would group certain functions together (for example all download
> functions, all form functions etc.) and just save them as .lib or .inc 
> files
> and include only the certain group I need on the specific page. I would 
> also
> save all the functions into one file, in case there is a page the requires
> many functions..
> 
> 


Message #5 by "Nikolai Devereaux" <yomama@u...> on Mon, 8 Apr 2002 09:18:28 -0700
BTW, if you have a file which only defines functions, then you can save
yourself some execution time by using require_once() or include_once() to
prevent the PHP interpreter from parsing the files every time you happen to
include() them.


Take care,

Nik

Message #6 by Empier4552@a... on Mon, 8 Apr 2002 16:32:19 EDT
--part1_156.bedcfc5.29e35853_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Thanks for all the advice guys, i've taken all into consideration and will 
see how it works, so far it seems like an ideal plan.


  Return to Index