[thelist] using includes and performance issues

David Bindel dbindel at austin.rr.com
Thu Feb 13 22:21:01 CST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> At 08:41 AM 2/13/2003, Tom Dell'Aringa wrote:
>
> >I'd say the average page has 10 includes. Some have less, some
> >more  detailed pages have more.
> >
> >Does this affect performance issues? If so how? I understand their
> > desire to keep a design standard and using includes is one
> way, and the
> >pages are all slightly different.

I used to use ASP, but have since moved to PHP.  If there's a chunk
of HTML that I need to include more than once in each page, I will
usually write a function that outputs the HTML whenever it is called.
 This means that the included file (in which the function is stored)
needs to be included only one time, because you may then call the
function as many times as you like.  This reduces the load on the
server because it only has to fetch the include file one time, but it
does require a tiny amount of time to output the HTML (or whatever
you want).

Here's an example written in ASP (if I can still write it
correctly!):

<%
Public Function OutputTableTop()
	Response.Write '<table width="95%" cellpadding="3" cellspacing="1"
border="0" align="center" class="PanelBorder">
		<tr class="GroupHeader">
		<td class="GroupHeader" valign="top">'
End Function
%>

Then instead of including the file over and over again, you could do
it like this:

<% OutputTableTop() %>
interior table
<% OutputTableBottom() %>
Etc.


HTH,
David Bindel

-----BEGIN PGP SIGNATURE-----
Version: PGP 7.0.4

iQA/AwUBPkxuXH6TtTuKuQdTEQJLKACfWWAaHstmFCUSljroho7PARftkM0An17Q
ZMnZgJWjLZRkqCuSAOk9BAq8
=9BHc
-----END PGP SIGNATURE-----




More information about the thelist mailing list