Digital Butter

Text

A custom TV in Evo

A few months back I created a custom TV renderer for Evo that I thought was super cool, until I saw some of the things extJs will allow you to do in Revo and then forgot about it…

Still, I came back to a project I used it on and where I used the CMS as an editor (rather than developer) and really appreciated this TV so I thought I would show it and see if anyone had any ideas how this might be best employed in Revo.

It works off a very similar structure to Jeff Whitfields plugin for EvoGallery coupled with ManagerManager where jQuery is being used to improve/enhance an existing TV form field.

My requirement in this case was to have a list of resources on the homepage be displayed in a specific order, whereby the admin is supposed to be able to choose which resources are displayed as well as in which order to display them. In context, this site is an F&B portal that frequently reviews and promotes restaurants, hence the need to ‘promote’ certain resources on to the homepage.

I have seen a couple of tutorials now on how to promote resource to the homepage using TVs (on the actual resource itself) and applying a TV filter with Ditto. That can work, but in this case I want to order the resources too, so a simple TV on a resource isn’t going to work. Plus, drag and drop reordering would be pretty neat, clients have come to expect that after all.

Long story short - here’s the TV in action, I have to give most credit to the jQuery plugin developer for this one, I’ve simply applied his brilliant plugin to any multiple select field in the resource edit panel:

So behind all of that is a normal multiple select TV field, but with the enhancements that the jQuery plugin gives you, you’re now able to actually sort the list as well as see all of the items you’ve selected from the list. The quick search is pretty cool too - especially when your list starts growing past the 100 mark. It’s all done client side so this is only scalable to a certain extent.

Now to actually using the TV itself, I’ve created a custom snippet that reads the TV value and processes the ID’s of the selected resources one by one *in order*. Code looks something like this, but don’t hold me to it:

<?
//assume tvValue is passed in a snippet call
$tvValue = (isset($tvValue)) ? $tvValue : ”;
$resources = explode(“,”, $tvValue);
foreach($resources as $resourceId){
     //load your resource fields here and apply templating here
}

?>

Next up - applying this to revo using MODext!

- JB

View comments
Posted on Sunday, August 1 2010.

Digital Butter We are a Website Design & Software Development team based in Hong Kong.
butter.com.hkOur new blog - The Churn Ask me anything Submit
Previous Next