RSS Feed

Blog

Creating Detail and Summary Views for ListIt in CMSMS

Creating Detail and Summary Views for ListIt in CMSMS
Posted on Feb 17, 2011 by Stephen Owens
Tutorial and Code category
   [ Return ]

List It is a very cool Module for CMS Made Simple (CMSMS). It allows very fast development of new CMS extensions (limitations and details of functionality are described in this post).

What it doesn't have, as of today, is a native way to show Summary and Detail views of the listed items. So I came up with this very simple method to show summaries and details of the lists, using Pretty Search Engine Firendly URLs, all without making any modifications to the ListIt source code.

Brief Overview of My Summary and Details Views for ListIt

Full details of this method with complete code, as well as proofs of concept, can be found in my fourm post on the CMS Made Simple website. However, I want to give a brief overview of the though process behind the madness. This whole process was done from directly inside the CMSMS admin section on my website. Very cool eh?!

The Summary Details Code is also available in this PDF.

I started by creating a UDT (User Defined Tag) in CMS Made Simple, which queries the database for details of a single item. An UDT is just a snipet of PHP code that is defined from the Admin section of CMSMS. My UDT creates an array of the data and stores it in a Smarty template array, which can then be accessed by the ListIt module.

UDT location in CMSMS Admin

Next, I created a simple default template to output the detail view for a single item.

Then, I looked at the URL structure for calling a CMS Made Simple Module directly. I whipped up a Test URL and checked to make sure everything was being passed to the module and the correct data was being retured ok.

Using a little mod rewrite action I created an .htaccess file to make the URL all pretty and search engine friendly.

Finally, after I had my URL structures defined. I created a summary template to show a list of all the available items in the list.

ListIt summary and detail view examples

Why I Created This Code

On the CMSMS forums allan1412 asked, "...Can anyone help with this? I need to use ListIt with a 'Summary / Detail' function similar to CGBlog ie display the summary content with a 'Read more' link to display the summary and full content in a separate page."

I thought sure why not help him out. I like to keep myself sharp by taking on the occasional pro bono jobs from fourms, or requests that people send me in emails. I do have to put bread on the table, so do NOT take this as "oh lets send Stephen an email cause hell he will code for free." No no. My family would starve.

About the List It Module for CMSMS

CMSMS Forge page for List It: http://dev.cmsmadesimple.org/projects/listit

List It is only in "beta" but it has great potetional, and is possibly one of my favorite plugins right now.

Benefits of List It

List It allows the CMS user to make quick lists of data user their own defineable fields. These fields can be of the types: text input, checkbox, text area, select date, upload file, select file, and dropdowns. It's also very easily definable with things like: input field size, max length, WYSIWYG editor, possible drop down values, possible file extensions, directory paths for file selections, date formats, etc...

It can also be cloned by simply changing the Module folder name, the file name of the main module file (ListIt.module.php), and the name of the class in that file. Three pretty small changes and the whole module has been cloned. Very nice.

Limitations of List It

The big drawback of this tool is that it is based upon a pseudo EAV datamodel. Meaning it's not approprate or very feasable to use it for large lists of data.

My Thoughts On the List It Pseudo EAV Datamodel

It's not a true EAV datamodel becuase the attributes that define the entities should be potentially vast, but in List It they are all predefined and set, which is more of a Attribute Value system. Except in an AV system one would have the entities as columns of the same table that contains the values. Where as, ListIt uses seperate tables to store the entites (the coulmns) and seperate tables to store the values. Which is indeed more like the EAV datamodel.

What My Thoughts Tell Me About the Future of ListIt

List It could be taken from the pseudo EAV datamodel that it is now, to an attribute–value system. This could be expanded upon to make List It into a very powerful content construction kit for rapid development of new modules by non-programmers. Maybe this is something I might even throw my code down on, at some point.

Furthermore, List It stores every value entered as a TEXT data type, regardless of whether it was setup as a varchar, boolean, timestamp, etc. The developer said it was setup like this becuase of the short development time frame. I can understand that. Jobs that pay are jobs that get the best product output.

Share
Like what you read? Get updates for free!
comments powered by Disqus