How to make editable template in ASP.Net MVC?

Asked

Viewed 204 times

4

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

There is some engine or similar in Asp.net MVC?

These codes (CSS, HTML) for being editable are written in database, as is done the reading dynamically of these codes?

  • I’ve never heard of it, but it wouldn’t be a bad idea to develop something like this.

  • I see in some Ecommerce systems, as I mentioned

  • But it must be proprietary code. I even imagine how to do it, but I don’t see it as a simple solution, and I doubt that some e-commerce system would open it up to Open Source.

1 answer

1

The "template" principle is simply a "search replace" principle. For example, vc makes 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 keywords, which cannot be mixed with others. then need simplistemnte prepares 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 don’t know how, but you should have a function like str_replace() in PHP.

With a template system a little but advanced, you can imagine TAG to repeat code blocks: XX_START1_XX et XX_END1_XX for example. Your code will fetch the incision, fetch the last and often copy the content between the two so for example to show various products.

Browser other questions tagged

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