How to make editable template in ASP.Net MVC?

4

I see in many systems (e-commerce mainly) the possibility to edit the system template by changing CSS and HTML documents.

Is there any engine or something like that in Asp.net MVC?

These codes (CSS, HTML) because they are editable are stored in a database, how do you read them dynamically?

    
asked by anonymous 01.10.2014 / 01:02

1 answer

1

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.

    
07.10.2014 / 03:09