Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: A few questions about understanding how Composite C1 works

$
0
0
Can I create a block of content, then I specify a few pages and page regions for this block to show up?
Yes - we haven't published an easy to install package that does this (we really should), so here a the steps needed to create such a package. Step by step, how to build up such a feature in c1:
  1. On the Data perspective, create a new Global Data type.
  2. On the Settings tab, name it "Shared content". Give it the programmatic name "Shared" and the namespace "Content" (names are up to you)
  3. On the Fields tab, create one field named "Title" and another field named "Content". Modify the last field in this way: make the length unlimited and (on the advanced tab) change the widget to Composite.Widgets.Text.VisualXhtmlEditor
  4. Save the data type
This gives you a data layer - in your case a new sql table - and some simple ui for editing content. Your type will show up in the tree, add some test data. To create a rendering function, do the steps below. Here we do it using a C# Function:
  1. On the Functions perspective create a new "Inline C# Function"
  2. Name it "RenderSharedContent", in the namespace "Content". Again - you own the naming. Press Finish.
  3. On the "Input Parameters" add new new parameter. Name it 'contentToShow' and make the parameter type "DataReference<Shared Content>"
  4. On the Source tab, paste in the code below.
  5. Save the function
To use the function do this: while editing a page, click Insert, Function, select Content.Shared and then select a content block.
Is this one time deal for all blocks?

Can I specify logic such as "shown on all pages" or "shown all selected pages" for this type of block?

Thanks!

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>