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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Customizing Search Results on a Profile
Pages: [1]

Author Topic: Customizing Search Results on a Profile  (Read 1943 times)

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Customizing Search Results on a Profile
July 28, 2008, 07:05:14 pm
Hi I would like to customize the results of a Profile, removing the icon on the left (Individual or Organization) and adding a link to the Name.

The image will illustrate my goal.

I am wondering what file within CiviCRM I need to edit to make this change?  I have unsuccessfully looked for the file in the /templates/CRM/Profile/* directory and started to look with in /CRM/* but got rapidly overwhelmed.

Help?

Thanks...!
Try CiviTeacher: the online video tutorial CiviCRM learning library.

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: Customizing Search Results on a Profile
July 28, 2008, 07:33:49 pm

The easiest fix is to edit the file: templates/CRM/Profile/Page/Listings.tpl

and skip the first element in the foreach loop on the lines 25 and 41. Thats a template change, no code changes involved

You'll need to check the smarty manual (http://www.smarty.net/manual/en/) for syntax details

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Customizing Search Results on a Profile
July 31, 2008, 01:26:36 pm
Thanks for the reference.  Indeed the icon can be removed with a Smarty template change.

Although there may be other (easier) ways this is how I did it, and I'm just posting here for posterity so other people can learn how.

This is a change to the file /templates/custom_directory/CRM/Profile/Page/Listings.tpl

Code: [Select]
      {foreach from=$row item=value name=foo}
      {if $smarty.foreach.foo.first}
        {* do nothing, and don't show the icon*}
        {else}
        <td>{$value}</td>
        {/if}
      {/foreach}

Thank you!
« Last Edit: July 31, 2008, 01:29:19 pm by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Customizing Search Results on a Profile
August 01, 2008, 12:03:26 pm
How could I go about turning the name into a link to their website?  What PHP file would I want to edit to make this hack?
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Customizing Search Results on a Profile
August 03, 2008, 05:34:01 pm
Assuming you are storing the "link to their website" in the contacts' Website field - what about just adding that field to your profile and then playing around w/ your customized template a bit?
Protect your investment in CiviCRM by  becoming a Member!

cwgng

  • Guest
Re: Customizing Search Results on a Profile
December 16, 2009, 02:57:19 pm
I know this is an old thread but it's worth making (what I think is) a correction to the smarty template customization made earlier.

I followed your instructions but found that the column headers and the contents of the columns in my customized profile listings view no longer lined up — which makes sense, actually, since the change instructs smarty to leave out the first td of each row. So my correction is to tell smarty to leave out the first th (table header) of the header row:

Code: [Select]
<tr class="columnheader">
{foreach from=$columnHeaders item=header name=bar}
    {if $smarty.foreach.bar.first}
          {* do nothing; don't create the first column header *}
    {else}
        <th scope="col">
        {if $header.sort}
            {assign var='key' value=$header.sort}
            {$sort->_response.$key.link}
        {else}
            {$header.name}
        {/if}
        </th>
    {/if}
 {/foreach}
</tr>


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Customizing Search Results on a Profile

This forum was archived on 2017-11-26.