Using template parser you can simply store and manage all application email templates in one place. This approach helps separate content from code sources and give you ability to edit them easily.
Almost every web site has a feedback form or a registration form. After validating user’s entries and do some actions it is necessary sometimes to send a notification email to the user or, for instance, to a moderator of the site. To achieve this goal you can
use the standard .NET classes (read more there and there if you are using .net 2). But how can you manage permanent content of emails inside your web application?
The simplest way is to hardcode email content and inserts dynamical values using concatenating functions inside page’s code. But what if you need to change design of email or add some functionality to page source? Email template can be very big and contain
a pile of dynamic variables with concatenation correspondingly. Looking into such source is horrible. Everybody knows it and in spite of this even professional programmers often choose the way to place content email in the source code.
Summarize all problems you can be faced with:
- Source of page that send email is hard readable because there is a lot of long string literals and a lot of concatenate operations
- You can not preview email template until you actually run the code
- It’s necessary to recompile application after even small content change in email template
The solution of the problem is simple – using email templates and parser.
Using Template Parser you can create XML documents from templates. It's much more simple.
If you have an example of XML document it's quite simple to create a template from it. Just place iteration blocks inside it and use Template Parser to generate XMLs.
And that's not all. You can use Template Parser for any type of text documents.
More about this project read here: