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 CiviMember (Moderator: Deepak Srivastava) »
  • Output Problem
Pages: [1]

Author Topic: Output Problem  (Read 1924 times)

daveb93

  • Guest
Output Problem
March 02, 2009, 05:18:07 pm
Hello ...
I have a profile built that returns a list of members that are tagged as "instructors".  Those members have both their real name and their "stage name" or callsign.

My profile works great.  Its output is as follows:

NAME        Instructor Name      Type      City     State.

I want to drop the NAME column and only have   

Instructor Name      Type      City     State

How would I do this specifically?

I have read about the custom template (using Listing.tpl) but I am not sure that that is the ticket as it looks like Listing.tpl only generates the page based on what is returned to it.

We really need to get this done as it is the hurdle keeping us from going live

Setup
Joomla 1.5.8
Mysql 5.0.22
CiviCrm 2.1.4

Thanks
 


daveb93

  • Guest
Re: Output Problem
March 02, 2009, 05:22:52 pm
More info ...
It looks as though the NAME field is being added as it is not part of the profile.
« Last Edit: March 02, 2009, 05:41:41 pm by daveb93 »

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Output Problem
March 02, 2009, 06:34:28 pm
You can eliminate the "hard-coded" NAME column using some extra "Smarty" logic in a custom version of Listings.tpl. You need to add a name= param to both foreach loops (the column headers and row cells loops) - and then use the "index" value to skip the item that has index = 1 (this is the column header and the row cell for the sort name).

Sample of this code snippet (using the 2.2 version - which should be similar):
Code: [Select]
      {foreach from=$columnHeaders item=header name=colHdr}
        <th scope="col">
        {if $smarty.foreach.colHdr.index NEQ 1}
        {if $header.sort}
          {assign var='key' value=$header.sort}
          {$sort->_response.$key.link}
        {else}
          {$header.name}
        {/if}
        {/if}
         </th>
      {/foreach}
      </tr>
   
      {counter start=0 skip=1 print=false}
      {foreach from=$rows item=row name=listings}
      <tr id="row-{$smarty.foreach.listings.iteration}" class="{cycle values="odd-row,even-row"}">
      {foreach from=$row item=value name=vals}
      {if $smarty.foreach.vals.index NEQ 1}
        <td>{$value}</td>
      {/if}
      {/foreach}
      </tr>
      {/foreach}
Protect your investment in CiviCRM by  becoming a Member!

daveb93

  • Guest
Re: Output Problem
March 02, 2009, 07:38:29 pm
Thank You Thank You !

That worked...


Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Output Problem
March 08, 2009, 04:51:00 pm
This if condition in the column header section should remove the Name column header (it's part of the code snippet above):

{if $smarty.foreach.colHdr.index NEQ 1}
...
{/if}
Protect your investment in CiviCRM by  becoming a Member!

daveb93

  • Guest
Re: Output Problem
March 08, 2009, 05:05:56 pm
this is what I have - still the "name" field  in the header shows

Code: [Select]
      <tr class="columnheader">
      {foreach from=$columnHeaders item=header}
 <th scope="col">
        {if $smarty.foreach.colHdr.index NEQ 1}
        {if $header.sort}
          {assign var='key' value=$header.sort}
          {$sort->_response.$key.link}
        {else}
          {$header.name}

        {/if}
        {/if}
         </th>
      {/foreach}

« Last Edit: March 08, 2009, 05:07:38 pm by daveb93 »

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Output Problem
March 09, 2009, 08:41:42 am
compare your foreach (2nd line of snippet) to mine... u need to add the name= param
Protect your investment in CiviCRM by  becoming a Member!

daveb93

  • Guest
Re: Output Problem
March 09, 2009, 09:25:29 pm
Ok ... That almost worked... actuallly it worked exactly as advertised ... it did remove name form the header and left a space where name is supposed to be.  It now looks kike this

                       

                  instructor name           type               city       state

Catherine       shotgun                    Dallas             TX         view       

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Output Problem
March 10, 2009, 09:55:03 pm
move the if and /if outside of the <th> and </th> tags
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Output Problem

This forum was archived on 2017-11-26.