0
Galera assembled a file called php.php as follows:
<?php
$nome = "nome";
$idade = "25";
$peso = "78";
include "layout.html";
This file includes the layout.html file, which is so:
<table align="center" border="1">
<tr>
<td>
Nome
</td>
<td>
Idade
</td>
<td>
Peso
</td>
</tr>
<tr>
<td>
variavel
</td>
<td>
variavel
</td>
<td>
variavel
</td>
</tr>
</table>
My question is. How to make php put variables into html, if you change html to php.
Does anyone know any way? I thought of creating a function that would exchange everything that counts% within html for $. Example:
%%nome%%
would be traded for $nome
.
Does anyone have any solution?
not sure, for this to work I would have to change the file to . php and want to keep it as . html understood
– Hugo Borges
You would have to replace the tags in the html file, of course changing the file extension is better.
– rray
this I know, good what I’m trying to do and php.php take the layout.html and put the variarei inside, and the layout.htlm serves only to assemble the layout and php and who assembles the page, understood?
– Hugo Borges
Buddy, I just tested the answer I gave you and it worked. Includes html in PHP and the variables I set in PHP appeared normal in .html. Which error appears to you?
– Diego
here only works if I change the layout.html file to layout.php
– Hugo Borges