Development Blog


Creating Topics in TouchPointCMS

November 11, 2009 at 8:44 PM | 0 Comments

Making good use of Topics in TouchPointCMS allow for bits-and-pieces of content to be used throughout your website. For example, if you have a call-out on your page that invites users to your twitter or facebook page and you want to use it throughout the site, you can do so easily. A topic may be invoked from within the WYSIWYG editor or directly in your HTML page template. 

Topics by themselves are simply sections of HTML code. Formatted text, links, images, even YouTube content may be embedded for use in multiple places on your website. A topic can be disabled at anytime without having to remove it from your content or your code. 

Invoking a topic in your editor

Once you have created your topic in the Topics section of the CMS, it may be invoked in either two ways: within your content (WYSIWYG) or on your template page as a control. 

To invoke a topic inline, simply enter the following into your page:

(!topic = 'my topic'!)

PLEASE NOTE, extra spacing was added on each side of the equal sign so that a topic named "my topic" is not actually rendered inside this post! Be sure to remove the spaces on each side of the equal sign. Once this is done, if you have a topic of this name, it will display in place of the line above. 

Invoking a topic on a template page

Now that you are able to invoke a topic inside your editor, your second option is to invoke it inside your template file. There are two ways to carry this out. 

The first option is to place the same line used earlier directly on your page. This will render the topic the same way it does inside the editor. In fact, any time this line is written in the HTML source, it will render the topic. 

The second option is to use a built-in control. This method is more advanced as it uses a .NET control. The advantage in this approach would be if you are customizing your template with logic and need to invoke a topic programmatically. 

In the following example, I will show how to invoke a topic based on whether "Condition" is true or false. The code below is written inline for the sake of this example and the minimum set of controls are used. 

<script runat="sever">

    protected void Page_Load (Object s, EventArgs e)
    {
        if (Condition)
            cntMyTopic.TopicName = "Topic 1";
        else
            cntMyTopic.TopicName = "Topic 2";
    }

</script>

<asp:Content runat="server">

    <!-- THE NEWLY ADDED TOPIC CONTROL -->
    <tpc:Topic runat="server" ID="cntMyTopic" />

    <!-- YOUR EXISTING PAGECONTENT CONTROL -->
    <tpc:PageContent runat="server" />

</asp:Content>

That's it! For beginners, the first method is the way to go. If you're an advanced user or a developer, and you want to gain more control over how topics are displayed, the second option to dynamically render topics is the best approach. 

Learn more about TouchPointCMS.




Home Features Screenshots Download Feedback Development Blog