Jump to content

SEO: Echoing HTML code


TheGallery

Recommended Posts

Hello everyone, This is probaly a silly question but i'd like to ask it anyway. Does it really make a different for search engines if you echo your html code within PHP? With all those conditions i use in my script, i am wondering if i should echo all the HTML code, or i should only use php in parts that is necessary. Example of what i am talking about: (this is the method i am currently using)

<span>Welcome back <?php echo $_SESSION['username']; ?> !</span>

alternative i am talking about:

<?php echo '<span>Welcome back ' . $_SESSION['username'] . '!</span>'; ?>

Link to comment
Share on other sites

RIght, just as i thought. Since we are in this topic, could you tell me which of the above techniques i mentioned is the best practice? Not for CEO, but for code maintenance, making other dev's life easier, etc.

Link to comment
Share on other sites

first approach has advantages that it will highlight the markup part. but it seems iritating (to me) in some case in bigger file eg. finding open braces,close braces etc second one wont highlight the markup but it will be better to distinguish the code flow. It will also process less coe as dsonusk stated. but that is negligble. I belive its depend upon developer tastes

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...