Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

The Community Blog is a personal opinion of community members and by no means the official standpoint of DNN Corp or DNN Platform. This is a place to express personal thoughts about DNNPlatform, the community and its ecosystem. Do you have useful information that you would like to share with the DNN Community in a featured article or blog? If so, please contact .

The use of the Community Blog is covered by our Community Blog Guidelines - please read before commenting or posting.


12 Differences When Templating Data Instead of Content

The template/data-paradigm is very common, where a template visualizes data provided by a query. This results in typical list/details systems like blogs, news, showcases and more. But when managing content on normal pages, this approach doesn't really work, which is why we need the template/content-paradigm. Here's what you need to know.

Brief Overview Data vs. Content Paradigm

In general, when a template works with data, it takes all content-items (like records) from a source, runs some query to reduce the items to show and re-sort them, then shows them and uses various rules to vary how it's shown (alternate rows, make bold if "Top"=true, etc.).

Content is usually not all items, but instead a small set of intentionally selected items manually assigned to a page/module so the template will only work with these items. In many cases it's actually just a single item, in others in can be a list of items, which the editor managed and ordered as desired.

These are the 12 Differences you should know:

1. Data Starts with Everything, Content with Only a Few Items

As you can see in the diagram above, the data-paradigm always starts with a full list of items - like "all customers" or "all blog entries". The content-paradigm on the other hand will assume some hidden force will retrieve a small subset or even just one item.

2. Content Knows Which Items Belong to the Instance

Since data is like a table used by all modules needing it, the module showing this item won't need an assignment. Basically all items are ready to be used. When working with a content-item as content though, these must be mapped to a module-instance, so that the engine knows which ones to retrieve. How does it know this? Read on...

3. Creating an Item on a Content-Template Will Assign it to That Template

This mapping of an item-to-template happens automatically when the editor creates a content-item on a template which is configured to work in this content-paradigm. So pressing a "edit" or "add" will create the information in the table, but also assign it to the current instance.  

4. Data is Value-Sorted, Content is Editor-Sorted

A blog must automatically sort it's posts by newest-on-top. This makes sense in many cases, but for the content-paradigm the editor usually wants more control. For example, the editor wants to manually set the order of images in a image-rotator: 

5. Content Can be Assigned to Other Templates for Re-Use...

A content-item can be assigned to one instance, but you can also assign it to other instances as well. Imagine a "person" content-type with a "contact this person" template. After entering Daniel the first time, I want to re-use him in other places, both with the same template as well as others. For this I can just select existing items and add it to new template-instances, using the "replace" button:

6. ...Re-Used Items Can be Sorted Differently Every Time

Being able to assign a person to other instances feels a lot like using a person-database and working with data. But there is one very large difference: since the assignment and sorting is manual, the editor can use different orders in each use-case. For example, when I list a few showcases on "international sites" the order can be very different than the order of the same items on "all sites" - simply because the editor finds other items more important in each case. 

7. Content Can Have Presentation-Settings

Imagine a few items like "Daniel (CEO)", "Raphael (2sxc Developer)" being assigned to the page "about us", shown in a template called "Brief profile". Even though this is a list of people, each person may need some additional presentation-settings like "Highlight: yes" on the CEO or "Hide details-button" on Raphael. These settings are per-item-on-this-instance, and should NOT be part of the content-item Daniel, because it doesn't describe Daniel and in another list showing Daniel, this highlight may not be desired.  

 

8. Content Can Have Different Presentation-Settings When Re-Used

This presentation information is bound to the item Daniel, when used on About-Us and not stored in the content-item Daniel itself. Because of this, re-using Daniel elsewhere can have different presentation settings. It can also be that a different template "Google Map" can show a Person, but the settings there would be very different. This is easy to do, because earch template decides what presentation-settings it wants to have.

9. Removing Content Only Removes the Assignment

Since the template receives all content-items assigned to it, hitting "remove" will not actually delete the item, but just un-assign it. This makes it easy to re-assign it in case this was a mistake, and it also keeps this item alive on all other use-cases. 

Note that this sometimes causes confusion, because some users imagine the remove to delete the item (which doesn't happen when using the in-page toolbar).

10. In-Page Toolbars are Different for Data and Content

Imagine you have the same template-file used, once with the content-paradigm, and once with a data-paradigm. The automatic toolbar like @Content.Toolbar or [Content:Toolbar] will be different as you can see:

This difference is important. Content-items which are tied to this template-instance (using the Content-paradigm) ca be moved up/down, replaced by another item and more. But if the item is just shown because it's part of the database, these operations don't make sence.

You'll also note that the normal add button [ + ] is also missing in the data-mode. This is because it would confuse the editor. In the Content-paradigm, add will create another item immediately after the current item. In data-mode, this won't happen, because sorting is based on other rules. So if the editor would klick add to create a new item, it would often not be visible after saving, causing a lot of confusion. 

11. Template-Configuration Tells the Toolbar How to Behave

So how does the toolbar know where this data came from? In the background, all assigned items have additional information like the order they are in. The toolbar uses this information to configure itself. 

12. Content-Items are Still Data

Please remember that content-items are still stored the same way as data would be stored. The only special is that they are assigned to a specific template-instance. Because of this, you can always create a template instance and assign items you previously used as data, and you can also create a template which retrieves all items previously only used in specific instances. Need an example?

  1. imagine you started with a content-type Person and a template which uses these in the Content-Paradigm, letting you add a template, edit people etc.
  2. After a while you maybe added various people all over the site...
  3. ...and now you want to create a new template listing all these. This can be done immediately, without any additional code or special configuration. 

TL;DR

I hope this helps clarify various questions you may have run into. Much of this is intuitive and logical when you see the examples. But then again, sometimes an explanation like this is helpful :). 

Love from Switzerland,
iJungleboy


Daniel Mettler grew up in the jungles of Indonesia and is founder and CEO of 2sic internet solutions in Switzerland and Liechtenstein, an 20-head web specialist with over 800 DNN projects since 1999. He is also chief architect of 2sxc (see forge), an open source module for creating attractive content and DNN Apps.



Read more posts by Daniel Mettler

Comments

DnnModule.com
Useful tips, thanks very much. I think these rules (tips) can be also used when we develop our custom DNN modules.
DnnModule.com Wednesday, December 21, 2016 9:24 PM (link)

Comment Form

Only registered users may post comments.

NewsArchives


Aderson Oliveira (22)
Alec Whittington (11)
Alessandra Daniels (3)
Alex Shirley (10)
Andrew Hoefling (3)
Andrew Nurse (30)
Andy Tryba (1)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (37)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Bogdan Litescu (1)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (213)
Chris Paterra (55)
Clint Patterson (108)
Cuong Dang (21)
Daniel Bartholomew (2)
Daniel Mettler (181)
Daniel Valadas (48)
Dave Buckner (2)
David Poindexter (12)
David Rodriguez (3)
Dennis Shiao (1)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (80)
Francisco Perez Andres (17)
Geoff Barlow (12)
George Alatrash (12)
Gifford Watkins (3)
Gilles Le Pigocher (3)
Ian Robinson (7)
Israel Martinez (17)
Jan Blomquist (2)
Jan Jonas (3)
Jaspreet Bhatia (1)
Jenni Merrifield (6)
Joe Brinkman (274)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Kelly Ford (4)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matt Rutledge (2)
Matthias Schlomann (16)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Miguel Gatmaytan (3)
Mike Horton (19)
Mitchel Sellers (40)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Oliver Hine (1)
Patricio F. Salinas (1)
Patrick Ryan (1)
Peter Donker (54)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Sacha Trauwaen (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott Schlesier (11)
Scott Wilkinson (3)
Scott Willhite (97)
Sebastian Leupold (80)
Shaun Walker (237)
Shawn Mehaffie (17)
Stefan Cullmann (12)
Stefan Kamphuis (12)
Steve Fabian (31)
Steven Fisher (1)
Tony Henrich (3)
Torsten Weggen (3)
Tycho de Waard (4)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (40)
Will Strohl (180)
William Severance (5)
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out