|All of these boxes have been floating around for a while but I've never had time to stick them on the Scoop Box Exchange. Now that they're there I realized that some require somewhat extensive deployment notes dueto some of the screwiness used to get the code to work within boxes rather than as part of the codebase. I like boxes bacause they allow site owners to add functionality in a semi-modular form without having to mess with the underlying server (IE: no restarts etc...) and because it bypasses the fact that Hurstdog is such a profectionist.|
The FAQ Display Box:
First, let's look at the FAQ display box. This box should be implemented as an OP. Panner did an excellant job withthe new OP interface. It eliminates a bunch of steps for creating box based OPs and also avoids the need for creating seperate templates for every OP. I havn't seen one yet so here's a little HOWTO for implementing a box based OP under the new system.
First, go get the faq_display box from the SBE. add the box through the box administration interface available by clicking on 'Boxes' in the 'Admin Tools' box on the right when you're logged in as a Superuser. In the box admin interface
The Box ID field is the name of the box as it will be called from inside templates. In this case it is 'faq_display'.
The box title is self explanatory but in most cases it is overridden by the box code which can reset it durring box processing. Set it to something that makes sense.
The box description exists for administrative convenience so insert whatever helps you recognize the purpose of this box, or any other notes about it.
The Box Content field is where you want to paste the box code from the SBE.
Once you have filled out the form, select 'Save Box' at the bottom to add it to the database and make it available for use.
Making faq_display into an OP: note - these directions apply to recent versions of scoop 0.9-dev
Go to the 'Ops' admin interface where we'll create a new OP for the faq_display box. The new OP will be called 'faq'. Our OP template (which actually the page template, rather than the op_template which defines the URL format, which will be discussed later) will be 'index_template', the same page template used for the 'main' and 'section' OPs. In the function field we specify our box 'faq_display' and mark the checkbox indicating that it is in fact a box. There is no special permission we want to require the user to have in order to use this new OP, so leave this field unchanged, but if we wished to restrict access to this OP, we could do so by indicating the required permission here. This OP should be enabled, so check the 'Enabled' checkbox. The OP should have a description that indicates it's function. Perhaps in this case "This OP formats a section so each story it contains appears as a FAQ item. Any section can be viewed in this format by substituting 'faq' for 'section' in the URL used to view any given section".
At this point we must establish the URL format for our new OP. This is done by editing a block called 'op_templates' so go to the block admin interface and select 'op_templates' from the menu at the top, then click 'get' to load that block. Scroll to the bottom of the block and add the following:
The format of the op_templates block is beyond the scope of this document but let it suffice to say that the above line indicates that the URL of the 'faq' OP will be of the format http://www.scoopsite.com/faq/sectionName where 'sectionName' is passed inot the system as the parameter named 'section'.
Congratulations! You now have a new box based OP. You will be able now to view any section in a FAQ-like format.
Deployment Notes for 'hidebox_box':
If you got this far looking for the technical details on the hidebox_box or the diarysub_box, here they are:
Both of these new boxes use a mechanism of passing a variable as an argument to a box, which works well but is not something normally done in scoop box management. First, the hidebox_box. Add the box to your DB, making certain that you have selected a box template other tan the one into which you intent to insert the box closer icon. If you fail to take note of this, you will create an infinate loop that will break you site by creating an infinate loop of interpolation. I recommend setting the box template to 'empty_box' (which should nontain nothing more than '|content|').
Now place the box call inside the target box template (most likely 'box') in the location you want the box closer icon to appear. The box call should look like this:
|bid| is being passed as an argument to our box. This variable was added in a recent CVS checking which included the code for subsections, so if you don't have the subsections feature, you can't use the hidebox_box. You will also need to establish a new cariable through 'Site Controls' called 'hidebox_icon' having for a value, the URL to the image you want to use for box closure. Here's a nice one. Test it out and have fun.
Deployment Notes for Diary Subscriptions:
Diary subscriptions are made up of two boxes. The 'diarysub_box' creates the subscribe/unsubscribe link and is ALSO called as an OP called 'diary'. First, add the diarysub_box through the box admin interface, then create an OP called 'diary' that calles the 'diarysub_box'. with the (url template) op_template: 'diary=/user'. Then add a call to the diarysub_box from the 'story_summary' box. The call should be of the form:
where we're passing the author ID variable to the box, causing it to return the subscribe/unsubscribe link, rather than the behavior seen when called as an OP. Note that the OP behavior is to either add or remove a subscription then to redirect back to the calling URL. For this reason, the page template specified for the OP is completely irelevant. It is however important that the box template specified for diarysub_box is set to 'empty_box' because any other template will cause the subscribe/unsubscribe link to be wrapped and generally mess up the formatting of your story_summary block.
The second piece of the diary subscription system is the diary enabled hotlist_flex box which you can aff from SBE as well, using the general box adding procedure and a more treditional box call from within index_template and default_template. More details on the behaviors of the original hotlist_flex can be found here. The original announcement of Diary Subscriptions describes them from a user perspective. :)
That's all folks...
57 Scoop users have viewed this story.