Forum Moderators: coopster

Message Too Old, No Replies

whats better echo or straight html?

         

dkin

1:01 am on Aug 30, 2005 (gmt 0)

10+ Year Member



What is better for your site, seo etc etc this

$gresult = mysql_query("SELECT * FROM games order by title asc", $link) or die ("query 1: " . mysql_error());
while ($grow = mysql_fetch_array($gresult))
{
echo '<option value="/games/xbox_games/'.$grow['title'].'.html">'.$grow['title'].'</option>';
}
echo '</select></form></td></tr>'
. '<tr><td class="gamelist_line"></td></tr>'
. '<tr><td id="gamelist_mid"></td></tr>'
. '</table>'
. '<div class="gamelist_foot"></div>';

With all echoes

or this

$gresult = mysql_query("SELECT * FROM games order by title asc", $link) or die ("query 1: " . mysql_error());
while ($grow = mysql_fetch_array($gresult))
{
echo '<option value="/games/xbox_games/'.$grow['title'].'.html">'.$grow['title'].'</option>';
}
?>
</select></form></td></tr>
<tr><td class="gamelist_line"></td></tr>
<tr><td id="gamelist_mid"></td></tr>
</table>
<div class="gamelist_foot"></div>

?

jatar_k

1:11 am on Aug 30, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



from an seo standpoint neither method is any different. The browser/spider only gets processed output they don't have any idea how it was made.

if you are wondering about speed then try this thread
Benchmarking PHP text output [webmasterworld.com]

jo1ene

1:55 am on Aug 30, 2005 (gmt 0)

10+ Year Member



Your second example. PHP should be embedded in HTML, not the other way around. I don't think there's an SEO issue, but it's better code.

dkin

3:16 am on Aug 30, 2005 (gmt 0)

10+ Year Member



quick question, I have all my pages coded like the first example, when I click view source on my page it is one very long line of code, the entire page is on one line except what is html coded, why is this?

DanA

6:36 am on Aug 30, 2005 (gmt 0)

10+ Year Member



you can add line feeds by adding \n :
</option>\n'

jatar_k

4:01 pm on Aug 30, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



note: make sure all your \n are between double quotes or they won't resolve properly