Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8520097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:26:24+00:00 2026-06-11T06:26:24+00:00

I have recently reading someone code. In his code I see a weird html

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:26:26+00:00Added an answer on June 11, 2026 at 6:26 am

    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.

    var songTemplate = "<li class=\"track\"><span class=\"num\">{{TRACKNUM}}.</span>" +
                       "<span class=\"title\">{{TITLE}}</span>" +
                       "<span class=\"duration\">{{DURATION}}</span></li>";
    
    
    var songs = [ { tracknum : 1, title : "Speak to Me/Breathe", duration : "4:13" },
                  { tracknum : 2, title : "On the Run", duration : "3:36" },
                  { tracknum : 3, title : "Time", duration : "7:01" } ];
    
    
    function makeTrack (song, template) {
        var track = "";
        track = template.replace("{{TRACKNUM}}", song.tracknum);
        track = template.replace("{{TITLE}}"), song.title);
        track = template.replace("{{DURATION}}", song.duration);
        return track;
    }
    
    function trackList (songs, template) {
        var list = "<ul class=\"tracklist\">";
        songs.forEach(function (song) {
            list += makeTrack(song, template);
        });
        list += "</ul>";
        return list;
    }
    
    
    var songlist = trackList(songs, songTemplate);
    parentEl.innerHTML = songlist;
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently started reading up on Grails and would like to use SQL
Well aware that DLR is here!! I have recently reading up on all of
I have recently started reading about dependency injection and it has made me rethink
I've been reading up on foreign keys and joins recently, and have been pleasantly
I have been reading a lot about HTML 5 and some of the changes
I have recently updated a Visual Basic 6 application that is an ActiveX exe,
I have recently been reading about the general use of prime factors within cryptography.
I have recently been reading up on the D programming language, and am interested
I've been doing some reading recently and have encountered the Law of Demeter. Now
I have recently noticed that my wp_options table seems to be a bit large.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.