Reusable content

Topics: General
Oct 12, 2011 at 1:29 PM

Hi,

Is there a way to create a piece of reusable content (i.e. HTML snippet) that can easily be edited and inserted into multiple pages as required by a non-technical user?

I want to create a snippet called "Banner Text" which appears on all pages, and which the client can easily update.

I know I can use functions to achieve this but they're not intuitive for non-technical people.

Thanks,

Rob

Oct 12, 2011 at 1:48 PM
Edited Oct 12, 2011 at 1:49 PM

Here is one way that could work:

  • Create a global data type with two fields
    Name string(64) using a textbox as widget
    Content string(max) using the XHTML editor as widget
  • Add a data record to this type, name it "Banner text"
  • Create a C1 Function that takes a datareference to your type, loads that data element and render the Content
    (let me know if I should be a wee bit more specific here)
  • Add a call to this function, calling it with a ref to your banner text

Now you can maintain the content is a user friendly way (by editing the data element). In case you need more snippets like this thay are easy to introduce - just add another data element and a function call.

Oct 12, 2011 at 1:53 PM
Edited Oct 12, 2011 at 1:54 PM

About the step "Create a C1 Function that takes a datareference to your type, loads that data element and render the Content" you could do this with no programming like this:

  1. Create a Visual Function for your type
  2. In the content, just have the "Content" field
  3. Save your visual function

In your template, add a call to this Visual Function and specify a filter that grabs your "Banner text" only.

Oct 18, 2011 at 11:58 AM

Thanks - worked perfectly.

Really starting to appreciate the flexibility of C1 now...