How can I create a collapsible block from page content using .tpl file? I'm using the FlickrGallery module - http://drupal.org/project/flickrgallery and its basic functionality is pretty great - it automatically pulls in photosets from the Flickr account and displays everything using shadowbox, which means it'll work on iPhones, iPads, etc. Once the user uploads a photoset on Flickr, it simply appears on the site - no fuss, no muss. And it's also domain-sensitive, so different subsites can have different galleries. Like I said, pretty great - except for one major issue:

The module works outside of Drupal's content system - it simply pulls in a page and everything's hardcoded. The problem is that the page displays all photosets and there's no way to limit the photosets displayed, by paging or otherwise.

I want to create a multimedia page with collapsible blocks for photos and video - the video is no problem using Collapsiblock, but with a large number of photosets, the user will need to scroll down to the bottom of the page to see all available content.

Here's my question: How would I place the page content into a collapsible block using the module's .tpl file? Any ideas greatly appreciated - this is my first post on Drupal Answers!

Here's the existing template (with a few mods):

&lt;?php 
/*
 * Available vars:
 * - $description: Containing the description of the FlickrGallery module you provided at the settings page
 * - $albums: Array that contains the image and titles with links
 */
?&gt;
&lt;div id='flickrgallery'&gt;
  &lt;div id='flickrgallery-description'&gt;&lt;?php print $description; ?&gt;&lt;/div&gt;
  &lt;div id='flickrgallery-albums'&gt;
    &lt;?php foreach ($albums as $key =&gt; $album) : ?&gt;
      &lt;div class='flickr-wrap'&gt;
      &lt;div class='flickr-image-link'&gt;
        &lt;?php print $album['image_link']; ?&gt;&lt;/div&gt;
        &lt;div class='flickr-title-link'&gt;
        &lt;?php print $album['title_link'];  ?&gt;&lt;/div&gt;
        &lt;div class='flickr-total'&gt;&lt;?php print $album['total'] . t(' Pictures'); ?&gt;&lt;/div&gt;
      &lt;/div&gt;
    &lt;?php endforeach; ?&gt;
  &lt;/div&gt;
&lt;/div&gt;


It would be great to call the code for collapsiblock - thanks for any ideas here!
i'm pretty sure all the core js and css files should handle both the collapsing and styling of the fieldset. you could simply add the fieldset into your code. however, if it is not added in by default for some reason you can use the following addition to your function code.

drupal_add_js('misc/collapse.js');
drupal_add_js('misc/form.js')


Below should be an opened fieldset example.

&lt;div id='flickrgallery'&gt;
  &lt;div id='flickrgallery-description'&gt;
    &lt;?php print $description; ?&gt;
  &lt;/div&gt;
  &lt;div id='flickrgallery-albums'&gt;
    &lt;?php foreach ($albums as $key =&gt; $album) : ?&gt;
     &lt;fieldset class=" collapsible collapsed"&gt; 
     &lt;legend&gt;&lt;span class="fieldset-legend"&gt;More Info&lt;/span&gt;&lt;/legend&gt; 
      &lt;div class="fieldset-wrapper"&gt; 
       &lt;div class='flickr-wrap'&gt;
        &lt;div class='flickr-image-link'&gt;
         &lt;?php print $album['image_link']; ?&gt;
        &lt;/div&gt;
        &lt;div class='flickr-title-link'&gt;
         &lt;?php print $album['title_link'];  ?&gt;
        &lt;/div&gt;
        &lt;div class='flickr-total'&gt;
         &lt;?php print $album['total'] . t(' Pictures'); ?&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
   &lt;/fieldset&gt;
  &lt;?php endforeach; ?&gt;
 &lt;/div&gt;
&lt;/div&gt;


To have it closed simply add collapsed to your class like &lt;fieldset class="collapsible collapsed"&gt;