functions and quotes

From: Date: Wed, 22 Aug 2001 16:56:40 +0000
Subject: functions and quotes
Groups: php.general 
Request: Send a blank email to php-general+get-63935@lists.php.net to get a copy of this message
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_hi.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

« previous php.general (#63935) next »