I have recently reading someone code. In his code I see a weird html text written like {VARIABLE} . What is that syntax mean? and how to create it? Thanks
I have recently reading someone code. In his code I see a weird html
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t initialize it. It’s part of their templating engine.
Regardless of how they are doing it, the idea is to find/replace “{VAR}” with the actual data you want.
The basic idea, regardless of what language is used to template it, is that you start with a string of HTML, pull out what you know you want to replace, and put in the data that you want.
I’ve shown you an ugly, ugly template (it’d be better if I only had to write in an array of variable names, and it did the rest… …or if it looked through the string to find
{{X}}and then looked through an object for the right value to replace what it found).This also has security holes, if you don’t control both the template and the data (if you allow for end-user input anywhere on your site, then you don’t have control).
But this should be enough to show how templates do what they do, and why.