đŸ’Ÿ Archived View for chirale.org â€ș 2007-12-19_b424813374ee24bd99b2fc0b107a73ad.gmi captured on 2024-05-12 at 15:27:10. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

collapsible content using contemplate

How to make a collapsible content body with Contemplate and the Drupal core “collapsible” function?

Contemplate

Make sure you’ve Contemplate enabled (through admin/build/modules)

Go to admin/content/templates and choose the type you want to display collapsible content within.

Enable body contemplate checking “Affect body output” and write (change field names):

> \<?php  
> drupal_add_js(‘misc/collapse.js’);  
> drupal_add_js(‘misc/drupal.js’);  
> ?\>  
> \<fieldset class=”collapsible collapsed”\>  
> \<legend\>\<?php print t(“My Translatable First Field
> Label”)?\>\</legend\>  
> \<div class=”fieldset-wrapper”\>  
> \<h2\>\<?php print t(“My Translatable First Field
> Header”)?\>\</h2\>  
> \<?php print $node-\>field_myfirstfield\[0\]\[‘view’\] ?\>  
> \</div\>  
> \</fieldset\>

> \<div class=”mysecondfield”\>  
> \<?php print $node-\>field_mysecondfield\[0\]\[‘view’\] ?\>  
> \</div\>

Update: If you want a collapsible box expanded by default, use class=”collapsible” without “collapsed” class.

See also:

Add collapsible content in Drupal @ Random Snippets

Add collapsible content in Drupal @ Random Snippets

https://web.archive.org/web/20071219000000*/http://drupal.org/project/contemplate

https://web.archive.org/web/20071219000000*/http://www.codesnippet.info/?p=52