If html, in this case an alt tag, is written via php, which takes the values of two database fields, puts them into variables and then displays them with echo, can bots see the values of the alt tags as they are displayed in the browser or as the code is here?
echo (...... alt="".$fld['name'] . " " . $fld['description']."".....)
I mean, if name = “apples” and description = “red and juicy”
do the search bots see alt = “apples red and juicy” or the code above?
I suspect its the code.
2
Answers
The search engines see exactly what your browser see’s. So in your example the code name=”apples” and description=”red and juicy” will be what the search engine sees.
This only applies to server side code (such as PHP). JavaScript code is sent to the browser along with the HTML and is executed client side by the browser.
There may be a case where, due to a misconfigured server your PHP pages will be served as text. If you load the page in your browser and use the browser “view source” option you can see exactly what is being sent to the browser.
It would be the output of the PHP into HTML, so:
would be read by the bot because they parse the HTML of a page. The PHP is processed into HTML on the server side, so the
$fld
hash, and therefore$fld['name']
/$fld['description']
is invisible to a search bot.