What are the {} tags in the middle of html

Asked

Viewed 421 times

0

On a web page with extension .html cannot use tags php right?

But I saw some pages html type codes {CONTEUDO} that displays a defined text in a file php '$tpl->CONTEUDO = "texto"'. But I don’t understand exactly the use of these tags { } to show something of php, you can display a variable or a constant in this way?

Php code:

    require("banco.php");
require("classes/funcoes.php");
require("classes/String.php");
require("classes/Template.class.php");

$tpl = new Template("html/template.html");

//-- Google ****
$tpl->PG_TITLE = "Rações Catarinense";
$tpl->PG_DESCRIPTION = "Rações Catarinense ";
$tpl->PG_KEYWORDS = "Rações Catarinense ";
$tpl->PG_CANONICAL = "http://www." . $_SERVER['SERVER_NAME'] . "/";
//-- Google ****
// Adicionando mais um arquivo HTML
$tpl->addFile("CONTEUDO", "html/produto.html");

$tpl->CSS = "produto";
$tpl->ATIVO_home = 'class="ativo"';

$tpl->PAGINA_ATIVA = "produto-body";

On the product page.html these attributes are displayed like this '{PAGINA_ATIVA}'

  • 1

    Only with this it is a little complicated answer can be a template defined by the user or even the CI ... if you have the complete code facilitates.

  • This is most likely the use of templates, for example, Mustache, or else Lightcandy.

  • I couldn’t understand it properly, but it seems that on the php page is used a class '$tpl = new Template("html/template.html");' and it defines the class attributes in the php file, in the html file they show these attributes using these tags { }

  • 1

    you have this code you can add to the question? example of the IC

  • What I’m looking for and I don’t think is if I can use these tags to display variables or constants in html. That is, if there is something way to display php inside a file . html

  • No, html files are not processed by PHP, it can happen from this markup({TITULO}) be replaced by a php file with str_replace() for example, this can also be done with javascript with some differences.

  • Related: http://answall.com/q/81607/101

Show 2 more comments

2 answers

1

This is a template. Probably another page is making a include with this page and making replace in content that has keys for the variable value.

1


Actually, php can also be written with . tpl files.

tpl is more like a Smarty File, where it serves as a command transitor, and they (PHP commands) can be called in tpl.html through {php} comandos {/php} for example

To make the call at the beginning of Header, you use {include file='arquivoX.tpl' p="index"}

You really can’t call PHP commands straight from . html because it would not pass the interpreter that generates the page, so to work it should be used or files . php <?php ?> or . tpl {php} {/php}

You can show us this page code to try to understand better?

  • 1

    I edited the question :)

  • 1

    I’ve seen this kind of tpl file, but I’ve never seen a website made that way. I found it very strange that he has a product.php file and a product.html and so with all pages, like why not put html together with php?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.