TheGallery Posted January 18, 2012 Share Posted January 18, 2012 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 More sharing options...
dsonesuk Posted January 18, 2012 Share Posted January 18, 2012 It wouldn't make any difference for SEO. SEO would have problem with JavaScript generate html, as it would not be able to read/see it at all! Link to comment Share on other sites More sharing options...
TheGallery Posted January 18, 2012 Author Share Posted January 18, 2012 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 More sharing options...
dsonesuk Posted January 18, 2012 Share Posted January 18, 2012 The first option is better as there is less php code to process in my opinion. Link to comment Share on other sites More sharing options...
birbal Posted January 18, 2012 Share Posted January 18, 2012 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.