Well, just off the top of my head, you seem to be mostly storing data.  
None of the strings you are storing contain any variable values, so they 
don't need to be double quoted.  I would even take it a step further, 
and move all your HTML data into raw text files, then use the readfile() 
function to insert them where needed.  This would make your program 
logic clearer and allow easier editing of the data since they would no 
longer need to have quotes escaped.  It would also be faster because it 
doesn't need to parse through all the data, it simply echoes what you 
need to the screen.  The overhead for printing multiple files is 
negligible in comparison... especially if you are calling this function 
from multiple pages... 

In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Kurth Bemis) wrote:

> i'm working on a site that is going to require some fancy image switching 
> based on URL called...thats part isn't a problem...the problem comes in the 
> way that i'm passing the HTML from the function.
> My main concern here is speed with the second being workload on the server.
> right now the function looks like this.
> function tab($section){
> $hmenav = "<a href=\"/index.php\" onMouseOut=\"MM_swapImgRestore()\" 
> onMouseOver=\"MM_swapImage('document.Nav2','document.Nav2','/images/nav/home_h
> i.gif','#931914015883')\"><img 
> src=\"/images/nav/home_off.gif\" width=\"62\" height=\"16\" border=\"0\" 
> name=\"Nav2\" alt=\"\"></a>";
> $comnav = "<a href=\"/company/index.php\" 
> onMouseOut=\"MM_swapImgRestore()\" 
> onMouseOver=\"MM_swapImage('document.Nav3','document.Nav3','/images/nav/com_hi
> .gif','#931914051666')\"><img 
> src=\"/images/nav/com_off.gif\" width=\"79\" height=\"16\" border=\"0\" 
> name=\"Nav3\" alt=\"\"></a>";
> $curnav = "<a href=\"/listings.php\" onMouseOut=\"MM_swapImgRestore()\" 
> onMouseOver=\"MM_swapImage('document.Nav4','document.Nav4','/images/nav/cur_hi
> .gif','#931914075550')\"><img 
> src=\"/images/nav/cur_off.gif\" width=\"113\" height=\"16\" border=\"0\" 
> name=\"Nav4\" alt=\"\"></a>";
> $llsnav = "<a href=\"/lls\"  onMouseOut=\"MM_swapImgRestore()\" 
> onMouseOver=\"MM_swapImage('document.Nav5','document.Nav5','/images/nav/lls_hi
> .gif','#931914098883')\"><img 
> src=\"/images/nav/lls_off.gif\" width=\"168\" height=\"16\" border=\"0\" 
> name=\"Nav5\" alt=\"land mark land services\"></a>";
> $navspc = "<img src=\"/images/spacer_blank.gif\" width=\"125\" 
> height=\"10\" border=\"0\" alt=\"\">";
> if ($section == "root"){
>       $hmenav = "<a href=\"/index.php\"><img src=\"/images/nav/home_on.gif\" 
> width=\"62\" height=\"16\" border=\"0\" name=\"Nav2\" alt=\"\"></a>";
>       }elseif ($section == "company"){
>       $comnav = "<a href=\"/company/index.php\"><img 
> src=\"/images/nav/com_on.gif\" width=\"79\" height=\"16\" border=\"0\" 
> name=\"Nav3\" alt=\"\"></a>";
>       }
>       print "$navspc$hmenav$comnav$curnav$llsnav";
> }
> section is passed to the function and the function returns the correct 
> tab.  IS there a better and faster way?
> ~kurth

Gabe da Silveira, Web Designer
Twin Cities Student Unions
University of Minnesota

wFone: (612)624-7270
hPage: http://www.visi.com/~jiblet

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]

Reply via email to