In a number of my websites I have a contact form which is always fairly customised to the clients needs.
To simplify the maintenance of this, I create a 'template' for the email in a text file and insert placeholders in sqaure brackets for text that will be replaced.
When a contact form is used, the send button calls a routine that grabs the text from the text file and replaces the placeholders with text from the form.
I want to create something like this in umbraco which will allow my clients to manage their own contact form emails.
Most of the functionality can be provided by my asp.net control but I want to provide a facility where the client can edit their own email template text file.
I can then reference that file in asp.net.
However how could you provide an interface to edit a text file in umbraco?
Move the functionality away from text files and store the "text content" in Umbraco nodes. You can use the API to pull out the text content via the nodeFactory class (referencing the nodeId). This can also help to separate out the email fields - like To, From, Reply-To, CC, Subject, Body template, etc.
Umbraco is flexible enough to handle whichever way to want to implement it.
You could - but I wouldn't. The reason is that it is so much easier to provide all the same flexibility and functionality by using one of Umbraco's own ways.
One way is to create a usercontrol that receives the text via public get/set properties, define a macro and declare the parameters (public properties) and allow it to be used in a richtext area. This will allow you to add this to any page.
Another way of doing it is by adding the needed field(s) to a document type, add a template and use the usercontrol as you defined it above. This will allow you to define exactly where the control should be and not let the (darn) user define it.
Edit a text file through umbraco
In a number of my websites I have a contact form which is always fairly customised to the clients needs.
To simplify the maintenance of this, I create a 'template' for the email in a text file and insert placeholders in sqaure brackets for text that will be replaced.
When a contact form is used, the send button calls a routine that grabs the text from the text file and replaces the placeholders with text from the form.
I want to create something like this in umbraco which will allow my clients to manage their own contact form emails.
Most of the functionality can be provided by my asp.net control but I want to provide a facility where the client can edit their own email template text file.
I can then reference that file in asp.net.
However how could you provide an interface to edit a text file in umbraco?
Thanks
JG
Hi JG,
There are a few ways you can do this:
Umbraco is flexible enough to handle whichever way to want to implement it.
Cheers, Lee.
Hello JG,
You could - but I wouldn't. The reason is that it is so much easier to provide all the same flexibility and functionality by using one of Umbraco's own ways.
One way is to create a usercontrol that receives the text via public get/set properties, define a macro and declare the parameters (public properties) and allow it to be used in a richtext area. This will allow you to add this to any page.
Another way of doing it is by adding the needed field(s) to a document type, add a template and use the usercontrol as you defined it above. This will allow you to define exactly where the control should be and not let the (darn) user define it.
Good luck
Jesper Ordrup
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.