+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / creating a sitewide variable for re-use (eg., an address or phone number)

creating a sitewide variable for re-use (eg., an address or phone number)

4 posts, 0 answered
  1. Harry
    Harry avatar
    23 posts
    Registered:
    07 Aug 2008
    11 Oct 2009
    Link to this post
    I'm new to Sitefinity. It's fantastic, but I'm still learning the best way to do everything.

    Is there an easy way to create a variable in the Web GUI somewhere and then just drop it into a part of a paragraph in a generic content field?

    Thank you!


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    12 Oct 2009
    Link to this post
    Hello nikolaus,

    Generally you could crate a CodeSnippets which are predefined. If this does not help, please elaborate some more about the desired result.  Let us know if there is anything else that we can do for you.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Harry
    Harry avatar
    23 posts
    Registered:
    07 Aug 2008
    12 Oct 2009
    Link to this post
    Hi Ivan,

    Each snippet is its own copy, correct? If so, then updating the snippet definition will not change all existing instances of the snippet in use?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    12 Oct 2009
    Link to this post
    Hello nikolaus,

    1. You need to extend the GenericContent Designer by creating a custom control that inherits from GenericContent Designer. Inside its template add a new Link button or other control.

    2. When the button is clicked insert some text in the RadEditor that will be parsed later.

    (( LinkButton )this.InsertButton).Attributes.Add ( "onclick", string.Format ( "pasteTextInRadEditor('{0}','{1}'); return false;",
                  this.ContentRadEditor.ClientID, "CustomText" ) );

    We use pasteHtml method from RadEditor's client side API

    function pasteTextInRadEditor(id,text)
    {
        var editor= document.getElementById(id);
        if(editor!=null)
        editor.control.pasteHtml(text);
    }

    Then you can override OnSaving() method, get the link text and parse it.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 0 answered