Why does text begin with #_ in HTML coding?
This question is probably for the PHP coders out there. I was looking at the code of the website I'm using and I came across something like this
<a href="{$config.root_url}/page.php">#_TEXTHERE#</a>
What is with the #_ text? How come it doesn't appe开发者_C百科ar in the HTML webpage when loading? I don't see it declared anywhere?!?!
Thank you!
EDIT: 40 minutes later, after finished a bowl of ramen, I figured it out. If anyone wants to knows why the weird code, I have a weird explanation in my next post.
The site is probably using a template engine or other system to replace that text. Probably for localization.
This is obviously a template HTML file you are looking at. When the PHP script is called, #_TEXTHERE# will be replaced by whatever is appropriate at the time. Some example code would be,
$replacements['#_TEXTHERE#'] = "Click this link to go here";
return $this->renderTemplate($replacements);
$replacements is an associative array that contains all the replacements for the HTML template.
Hey everyone, thank you for your QUICK replies. I think this is a very good community =).
And I understand the what it means now thanks to your explanations.
Yes, you all guessed it right. This code is NOT found anywhere. It was originally something like
<a href="{$config.root_url}/home.php">#_TP_Home_#</a>
I edited it thinking you all would reply with like "oh texthere is usually replaced with... under (whatever) situation." But that's not the case here. I learned to put more context next time. I'm a newbie php coder, sorry for the trouble.
精彩评论