Say you’re not particularly tech-savvy client wants to select Resources manually to promote on the Home page with a teaser. You could create a Custom Manager Page (CMP) that lets the client select (and de-select) the pages, but writing a CMP is a fairly challenging process.
You could write code that adds options to the right-click menu in the Resource Tree to add and remove resources from the list, but that’s even more challenging than creating a CMP.
You could create a form in the front end for the selection, but if you have a lot of Resources, you’d have a monster drop-down list or a lot of checkboxes.
You could also create a Template Variable and a custom snippet to check the TV, but that would make for fairly slow page loads because the snippet would have to check the TVs for all pages on the site. Worse yet, the client would have to edit each Resource to select or de-select it.
The getResources snippet will display teasers for you, and its
&resources property will let you specify a comma-separated list that determines which ones will be shown. We just need a way to make it easy for the client to create that list. The client could just edit the snippet tag, but some clients don’t like to mess with anything that they consider “code,” which often includes snippet tags. Worse yet, the snippet tag will be most efficient if it’s in the Template — buried in a lot of other scary code. In addition, if they mess up the tag in any way, the page can look truly terrible or the teaser display will disappears altogether (and they’ll think they’ve broken the site).
Here’s a very low-tech (but very efficient) way to let the client select specific Resources to promote on the Home page (or any page) without seeing anything scary.
Create a chunk called HomePageResources. In it, put nothing but a comma-separated list of IDs that get shown on the Home page (no spaces).
Put a getResources tag on the Home Page where you want the teasers to appear, with this property:
Create another chunk with tags to serve as the Tpl chunk for getResources (let’s call it
TeaserTpl) and specify it in the
&tpl property of the getResources tag on the Home page.
TeaserTpl chunk might look Something like this:
Now, all the client has to do to update the display is to look in the Resource tree and note the IDs of resources to be shown and type them into the chunk (and remove the ones that should no longer be shown). If the client knows the pagetitle (or part of it) for a Resource they want to add or remove, they can use the Search box at the top of the Resource tree to find the ID.
To improve page-load speeds, you’ll want to call the getResources snippet cached (as it appears above). That means you’ll have to remind the client to clear the site cache from the Manager’s Top Menu whenever the list changes.
The tag specifying the value of the
&resources property in the getResources snippet tag will be replaced with the comma-separated list in the chunk and Bob’s your uncle. The client never has to deal with (or even see) the snippet tag.