CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Adding content using civicrm templates.
Pages: [1]

Author Topic: Adding content using civicrm templates.  (Read 2729 times)

dougall

  • Guest
Adding content using civicrm templates.
April 02, 2008, 05:12:20 am
Hi,

I'm successfully adding some content to the Tabbed.tpl template after following the instructions here:
http://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in+and+Profile+Screens

What I want is to add a new collapsible block ("circleMembership") viewable for Individuals in a similar fashion to "demographics_show" and "demographics", so I've added my block to the {if $contact_type eq 'Individual'} section in the following manner:
Code: [Select]
{if $contact_type eq 'Individual'}
<div id="demographics_show" class="section-hidden section-hidden-border">
   ....etc etc etc.....
 </div>

<div id="demographics" class="section-shown">
   ....etc etc etc.....
 </div>

 
<div id="circlemembership_show" class="section-hidden section-hidden-border">
  <a href="#" onclick="hide('circlemembership_show'); show('circlemembership'); return false;"><img src="{$config->resourceBase}i/TreePlus.gif" class="action-icon" alt="{ts}open section{/ts}"/></a><label>{ts}Circle Membership{/ts}</label><br/>
 </div>

<div id="circlemembership" class="section-shown">
 <fieldset>
  <legend><a href="#" onclick="hide('circlemembership'); show('circlemembership_show'); return false;"><img src="{$config->resourceBase}i/TreeMinus.gif" class="action-icon" alt="{ts}close section{/ts}"/></a>{ts}Circle Membership{/ts}</legend>
  <div class="col1">
    <label>Circle Membership:</label>
  </div>
  <div class="col2">
    <label>Membership details not yet available</label>
  </div>
  <div class="spacer"></div>
 </fieldset>
</div>

 {/if}

However both the circleMembership_show div and the circleMembership div are displayed. It appears that I must somehow add the id of my div to the $showBlocks and $hideBlocks array so that it is correctly initialized by this code at the end of the template:
Code: [Select]
<script type="text/javascript">

   init_blocks = function( ) {
{/literal}
      var showBlocks = new Array({$showBlocks});
      var hideBlocks = new Array({$hideBlocks});
{literal}
      on_load_init_blocks( showBlocks, hideBlocks );
  }

  dojo.addOnLoad( init_blocks );
 </script>

However I'm not quite sure where to start with doing this. If anyone could point me in the right direction I'd be very grateful.

...dougall

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Adding content using civicrm templates.
April 02, 2008, 01:16:20 pm

can you do something simple as:
Code: [Select]
<script type="text/javascript">

   init_blocks = function( ) {
{/literal}
      var showBlocks = new Array({$showBlocks});
      var hideBlocks = new Array({$hideBlocks});
      showBlocks.push( 'circlemembership' );
      hideBlocks.push( circlemembership_show' );
{literal}
      on_load_init_blocks( showBlocks, hideBlocks );
  }

  dojo.addOnLoad( init_blocks );
 </script>
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

dougall

  • Guest
Re: Adding content using civicrm templates.
April 02, 2008, 03:59:41 pm
yes, that does it ... apologies, i should have figured this out for myself

thanks for your help (again) ... dougall

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Adding content using civicrm templates.

This forum was archived on 2017-11-26.