Click here to Skip to main content
13,287,856 members (53,427 online)
Rate this:
Please Sign up or sign in to vote.
See more:
At some HTML source file i get some code like this
  <div id="header">
   <img src="{{companyLogo}}"/>
   <p id="companyName">{{companyName}}</p>
  ...... <!-- and many {{...}} tag -->

{{companyName}} and {{companyLogo}}
This tag is output from database like
echo $companyName;
in PHP.
My question is how it can display data from database? because it's just .html file.
There are no special tag except the {{..}} tag.
Is there any php framework that similar to use {{..}} tag ?

Many thanks for share the answer.
Posted 23-Sep-12 4:14am
Mohibur Rashid 23-Sep-12 10:53am
what framework are you using with php?
nK0de 23-Sep-12 10:56am
what is this {{}} tag? I've never seen it.
SamarRizvi 23-Sep-12 16:09pm
Why do you want to use a tag {{..}} like this?
h4ckjr 24-Sep-12 0:10am
I don't know what is the php framework.
I just make a template for this web using HTML and CSS from PSD document, and then i have to replace the content with {{..}} such as {{companyName}} and others.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

There is no such tag as "{{}}".
But it can be done something like this example:
// These can be read from a database
$companyName = "Name";
$companyLogo = "Logo Url";
//$html = file_get_contents("file.html");
$html = "...{{companyName}} and {{companyLogo}}...";
$tags = array('{{companyName}}' , '{{companyLogo}}');
$values = array($companyName, $companyLogo);
$replaced = str_replace($tags,$values,$html);
echo $replaced;
h4ckjr 25-Sep-12 3:04am
Hi Huseyin thanks for the solution. :)
I think the {{}} is custom tag that define constant in php.
Huseyin Atasoy 25-Sep-12 4:21am
You can use anything that you want instead of {{}}. For example you can write <myvalue> or valMYVALUEval. We do that just to make them unique in a html page to prevent real contents from being replaced and making it easy to understand that they will be replaced.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.171207.1 | Last Updated 24 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100