Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jules 205 posts 448 karma points
    Feb 09, 2010 @ 14:14
    Jules
    0

    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

     

     

     

     

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Feb 09, 2010 @ 14:49
    Lee Kelleher
    0

    Hi JG,

    There are a few ways you can do this:

    • Quickest and easiest way is to store your text files in the /scripts/ folder - then you can edit them via the Settings section (under Scripts).
    • 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.

    Cheers, Lee.

  • Jesper Ordrup 1000 posts 1478 karma points MVP
    Feb 09, 2010 @ 15:09
    Jesper Ordrup
    0

    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

     

  • 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.

Please Sign in or register to post replies