Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do square brackets mean in html?

I am assisting on a project right now and building out templates for the first time, trying to wrap my head around a few things but one aspect of the html that's confusing me are certain things sitting in square brackets. I've never used these in html before so I'm just wondering what they are for (when I open the page in a browser they all show up as text)

Here's a bit of the code:

<div class="container">
   [HASBREADCRUMBS]
   <ol class="nav-breadcrumb">
      [BREADCRUMBS]
   </ol>
   [/HASBREADCRUMBS]
   <h1 class="header-title" style="color:[TITLECOLOR];font-size:[TITLESIZE];">[TITLE]</h1>
</div>
like image 920
tganyan Avatar asked Mar 18 '23 13:03

tganyan


2 Answers

It's using some templating engine and the whole page is parsed before getting output to the browser. During parsing, those square bracket tags work as something else (depending on the templating engine used).

So, for example, [HASBREADCRUMBS] and [/HASBREADCRUMBS] could denote a piece of code that might be similar to:

if (breadcrumbs) {

and:

} // closed if

and for each value of the breadcrumbs object (whatever it might be) one ordered HTML list is rendered with the breadcrumb value as its content ([BREADCRUMBS]).

So in short: it's not HTML, that part of the file never reaches the browser but is converted into proper HTML (based on conditions, can also use loops, etc.) before rendering.

like image 198
Shomz Avatar answered Mar 28 '23 21:03

Shomz


The square brackets have nothing to do with HTML. They probably belong to the template and will be replaced by actual value from the template engine.

like image 42
Lakshmi Avatar answered Mar 28 '23 20:03

Lakshmi