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}'
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.
– rray
This is most likely the use of templates, for example, Mustache, or else Lightcandy.
– tayllan
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 { }
– Maira
you have this code you can add to the question? example of the IC
– rray
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
– Maira
No, html files are not processed by PHP, it can happen from this markup(
{TITULO}
) be replaced by a php file withstr_replace()
for example, this can also be done with javascript with some differences.– rray
Related: http://answall.com/q/81607/101
– Maniero