Scoop -- the swiss army chainsaw of content management
Front Page Everything News Code Help! Wishlist Project Scoop Sites Dev Notes Latest CVS changes Development Activities
Fun with boxes (including diary subscriptions) Boxes
By hillct , Section Code []
Posted on Wed May 08, 2002 at 12:00:00 PM PST
I finally got a few free moments to upload some boxes a lot of folks have been asking for. They're now available on SBE. Besides for the purpose of self-rpromotion, You will find herein, and explanation of the somewhat detailed deployment requirements particularly for the Diary Subscription Box and the Displayable Box Closer Box as well as, to a lesser extent the FAQ Display Mode Box & the New Hotlist_Flex with Diary Subscription Support.

Detailed implementation notes follow.

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 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: |BOX,hidebox_box,|bid|| where |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...
< Edit Queue? | Rio de Janeiro, Brazil >

create account
report bugs
Scoop Administrators Guide
Scoop Box Exchange

Make a new account

Which is better for adding scoop features?
I like implementing in boxes 33%
I like implementing in the codebase 0%
Contribute to scoop? are you crazy? 0%
I wouldn't go near that code with a 10 foot pole 0%
Perl... What's Perl? 0%
# I Like 3 66%

Votes: 3
Results | Other Polls

Related Links
Diary Subscription Box
Displayabl e Box Closer Box
FAQ Display Mode Box
New Hotlist_Flex with Diary Subscription Support
Scoop Box Exchange
Hurstdog is such a profectionist
faq_displa y
a nice one
Diary Subscriptions
More on Boxes
Also by hillct

Story Views
  57 Scoop users have viewed this story.

Display: Sort:
Fun with boxes (including diary subscriptions) | 1 comment (1 topical, 0 hidden)
Newbie misunderstandings (none / 0) (#1)
by Marco Rossi on Sun Oct 27, 2002 at 04:24:18 PM PST

Here's what Panner had to explain to me:

First, add the diarysub_box through the box admin interface

Requires, besides of copying the code from SBE, also to select the template "empty box" in the box admin interface, or else a huge box appears in the place [Subscribe] should be.

then create an OP called 'diary' that calles the 'diarysub_box'. with the (url template) op_template: 'diary=/user'.

Requires going to admin tools > block_programs, going to the op_templates list, adding a comma to the last item and a line "diary=/user". And then, creating a new op called "diary", and then creating the OP from the admin menu (people might forget to mark the "function is a box" checkbox).

Then add a call to the diarysub_box from the 'story_summary' box. The call should be of the form:


Bzzt! It's not the 'story_summary' box but the 'story summary' block, accessible from admin tools > blocks > content.

Besides of the explanation, you did a really fine job with the box. I think this explanation should be linked to box information in the SBE.

Fun with boxes (including diary subscriptions) | 1 comment (1 topical, 0 hidden)
Display: Sort:

Hosted by Powered by Scoop
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest 1999 The Management

create account | faq | search