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) »
  • Accessing Custom Data in the Summary.tpl file
Pages: [1]

Author Topic: Accessing Custom Data in the Summary.tpl file  (Read 3145 times)

holdtotherod

  • Guest
Accessing Custom Data in the Summary.tpl file
November 13, 2009, 05:25:39 am
I'm sorry, I'm sure there's an answer to this somewhere, but I just can't find it.

I'm using a custom Profile via Summary.tpl which is working in my civicrm_custom/CRM/Contact/Page/View/ directory.  I can access the custom data by accessing the $viewCustomData array, but I was wondering if there was a better way.  Can you use the $profileFields_ProfileID => Field Name => label/value access method?  I think it only works in the View.tpl and Edit.tpl files, but I'm not sure.  I also can't even figured out when those View.tpl and Edit.tpl files are used or how I should customize them for my purposes. 

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: Accessing Custom Data in the Summary.tpl file
November 13, 2009, 08:12:01 am

by default u can use all the fields that are exposed in the smart template in that format

you cannot use the profile fields in the contact summary template unless u expose them using some code in pageRun hook

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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Accessing Custom Data in the Summary.tpl file
November 14, 2009, 01:58:18 am
Or modify the template and fetch the extra fields you need using crmAPI

http://civicrm.org/node/599

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

holdtotherod

  • Guest
Re: Accessing Custom Data in the Summary.tpl file
November 16, 2009, 11:28:10 pm
Thanks for your help!  I guess I should try to describe my situation a little better.

In our organization we have different types of individuals/contacts.  An individual might start as a potential contact with limited contact information, and then develop into a full contact with more information, including custom data fields.  We want to be able to have different summary screens for each of these different types of contacts.  I read about creating custom Screens based on the record's Profile ID, specifically with examples for the View.tpl and Edit.tpl pages on http://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in%2C+Profile%2C+Contribution+and+Event+Registration+Screens.  However, I looked at those two files and they're almost empty.  Where can I go to see examples of these files modified?  

When I click a link to my contacts, the contact summary page is displayed using the CRM/Contact/Page/View/Summary.tpl page.  I made a custom version and put it in civicrm_custom/CRM/Contact/Page/View/Summary.tpl, but this custom Summary page is shown for every profile.  I tried putting it in civicrm_custom/CRM/Contact/Page/View/(Profile ID)/Summary.tpl to tie it to the specific profile ID, but it didn't work.  This led me to believe I need to edit the CRM/Profile/Page/View.tpl page and put it in civicrm_custom/CRM/Profile/Page/(Profile ID)/View.tpl.  However, I'm not sure if I need to edit this file, when it's called, or what to put in it.  How do I have a custom Summary screen based on a record's Profile ID?

Lastly, I am trying to expose the custom data fields in the pageRun hook as suggested.  This would allow me to then populate my custom summary screens with the custom data we collect.  Do I need to build the $profileFields_ProfileID array myself or is there another method I can call to build it?  
« Last Edit: November 16, 2009, 11:30:01 pm by holdtotherod »

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: Accessing Custom Data in the Summary.tpl file
November 17, 2009, 09:30:14 am

The contact summary is different from a profile. The contact summary is used for ALL contacts when displaying summary information (civicrm/contact/view/). Profiles are displayed via civicrm/profile/view

you might want to read the chapter in the book: http://en.flossmanuals.net/CiviCRM/CapturingExposing

yes, u'll need to build the array yourself. You should reuse some of the civicrm functions to make your work easier


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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Accessing Custom Data in the Summary.tpl file
November 17, 2009, 10:41:58 am
Hi,

First, the 3.1 version around the corner is going to provide contact subtypes, with different custom fields (really great).

As for your need, you can change the template for the summary, and within the summary fetch more information (eg extra fields, or groups or whatever), and based on that, change the display.

you can do all the fetch you need if they aren't already in the template by using crmAPI, (everything that is available through the api is something you can add to your template.

X+



-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Accessing Custom Data in the Summary.tpl file

This forum was archived on 2017-11-26.