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) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Hiding empty fields via {if $value} override not working.
Pages: [1]

Author Topic: Hiding empty fields via {if $value} override not working.  (Read 982 times)

Durruti

  • I post occasionally
  • **
  • Posts: 49
  • Karma: 1
    • The Kindling Trust
  • CiviCRM version: 3.4
  • CMS version: Drupal 6.20
  • MySQL version: 5.0.77
  • PHP version: 5.2.17
Hiding empty fields via {if $value} override not working.
April 05, 2011, 04:41:06 am
Hey all,

The solution in the documentation for hiding empty profile fields (http://wiki.civicrm.org/confluence/display/CRMDOC33/Hiding+empty+fields+on+a+profile+page.) doesn't seem to work anymore. I'm assuming this is to do with the change from tables to div formating, has anyone already come up with a working solution?

Many thanks,
Matt
 
http://feedingmanchester.org.uk

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Hiding empty fields via {if $value} override not working.
April 05, 2011, 10:26:59 am
I think this should work. Try it out, and if it does please update the new version of page at: http://wiki.civicrm.org/confluence/display/CRMDOC40/Hiding+empty+fields+on+a+profile+page.

Code: [Select]
{foreach from=$profileFields item=field key=rowName}
     {if $field.value} {* code to add *}
              <div id="row-{$rowName}" class="crm-section {$rowName}-section">
                <div class="label">
                    {$field.label}
                </div>
                 <div class="content">
                    {$field.value}
                 </div>
                 <div class="clear"></div>
              </div>
       {/if} {* code to add *}
  {/foreach}
Protect your investment in CiviCRM by  becoming a Member!

Durruti

  • I post occasionally
  • **
  • Posts: 49
  • Karma: 1
    • The Kindling Trust
  • CiviCRM version: 3.4
  • CMS version: Drupal 6.20
  • MySQL version: 5.0.77
  • PHP version: 5.2.17
Re: Hiding empty fields via {if $value} override not working.
April 06, 2011, 04:03:50 am
That's brilliant Dave, thanks for the reply. The change from $value to $field.value fixes it for me. I've made the necessary changes in the documentation for 3.4/4.0, as you suggest.

Many thanks again,
Matt
http://feedingmanchester.org.uk

ratinakage

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
Re: Hiding empty fields via {if $value} override not working.
February 27, 2012, 11:42:27 pm
Hi all,

Seems the main documentation never got updated.

I'm confused.  Where should I be putting that code to make it work?

Cheers....

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Hiding empty fields via {if $value} override not working.
February 28, 2012, 09:47:07 am
I've cleaned up the doc so it's consistent w/ the current template code:

http://wiki.civicrm.org/confluence/pages/viewpage.action?pageId=47710954
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Hiding empty fields via {if $value} override not working.

This forum was archived on 2017-11-26.