Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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):

<?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
 */
?>
<div id='flickrgallery'>
  <div id='flickrgallery-description'><?php print $description; ?></div>
  <div id='flickrgallery-albums'>
    <?php foreach ($albums as $key => $album) : ?>
      <div class='flickr-wrap'>
      <div class='flickr-image-link'>
        <?php print $album['image_link']; ?></div>
        <div class='flickr-title-link'>
        <?php print $album['title_link'];  ?></div>
        <div class='flickr-total'><?php print $album['total'] . t(' Pictures'); ?></div>
      </div>
    <?php endforeach; ?>
  </div>
</div>

It would be great to call the code for collapsiblock - thanks for any ideas here!

share|improve this question
add comment

1 Answer 1

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.

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

To have it closed simply add collapsed to your class like <fieldset class="collapsible collapsed">

share|improve this answer
    
Thanks for the suggestion, @austin - it doesn't work, unfortunately. The content block remains open and visible (although as far as the page is concerned, it's closed; content that's lower on the page displays as though the block was closed.) I added function theme_flickrgallery_preprocess_page(&$variables) { drupal_add_js('misc/collapse.js'); drupal_add_js('misc/drupal.js'); } –  Billy Cobin Jul 31 '12 at 18:37
    
maybe put the fieldset just before the <div class='flickr-wrap'>. do you have any js errors? –  austin Jul 31 '12 at 18:44
    
Whoops - still getting the hang of DrupalAnswers over here. As I thought, putting fieldset there creates nested fieldsets - the collapse.js script doesn't fire. I should have mentioned I'm on Drupal 7, BTW. No .js errors. Thanks! –  Billy Cobin Jul 31 '12 at 18:50
1  
obviously you can confirm that collapse.js is available? Since this is D7, i think you need to add, misc/form.js. Some of the stuff I'm reading out there. basically this should work with drupal 7. <?php drupal_add_js('misc/collapse.js'); drupal_add_js('misc/form.js'); ?> <fieldset class=" collapsible collapsed"> <legend><span class="fieldset-legend">More Info</span></legend> <div class="fieldset-wrapper"> <h3>Content goes here</h3> <p> test </p> </div> </fieldset> –  austin Jul 31 '12 at 19:01
    
You are a God! (or Goddess - "Austin" could be a girl's name or simply from whence you hail.) I can get this to work, or perhaps even use Collapsiblock by using the same method to access the .js files. Thank you SO much... you rock! –  Billy Cobin Jul 31 '12 at 19:20
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.