The "template" principle is simply a "search replace" principle.
For example, you make an HTML document with:
<b>Ola senhor XX_NOME_XX, tudo bem?</b>
Aqui na cidade de XX_CIDADE_XX, tudo certo
In this document you put key words, which can not be mixed with others.
then need to simplify two tables:
$tab_out[0] = "Marcello";
$tab_out[1] = "Brasilia";
$tab_in[0] = "XX_NOME_XX";
$tab_in[1] = "XX_CIDADE_XX";
Then, you do a "search replace". In ASP, I do not know how, but it should have a function like str_replace () in PHP.
With a slightly more advanced template system, you can image TAG to repeat blocks of code:
XX_START1_XX et XX_END1_XX for example. Your code will fetch the beginning, fetch the last, and often copy the content between the two, for example to display various products.