Answers.Body: <p>Add {debug} to your .tpl and you will find all available variables.
  Not all expected variables are available in all template.</p>
  
  <p>One way to get more variables in the .tpl file is to use the API in smarty code.</p>
  
  <p>More info about {debug}:
  <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Debugging+for+developers" rel="nofollow">https://wiki.civicrm.org/confluence/display/CRMDOC/Debugging+for+developers</a></p>
  
  <p>More info about using the API in smarty:
  <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Smarty+API+interface" rel="nofollow">https://wiki.civicrm.org/confluence/display/CRMDOC/Smarty+API+interface</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-11T20:56:52.827Z
Answers.Text: Thank you @Catorghans. I knew the variables weren't exposed to the template, but I wasn't aware of the options for the Smarty API. I played with it for a while and couldn't seem to get data related to just the current donation, or figure out sorting. So, I ended up adding PHP code to expose the variables to the Smarty template.
Answers.UserDisplayName: Jacobo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-11T06:20:28.873Z
Answers.LastActivityDate: 2016-04-11T06:20:28.873Z
Answers.UserDisplayName: Catorghans
Answers.Body: <p>I ended up solving this by following existing code examples in the two files below (I know this is a hack of core files, but we are moving away from Civi and won't be upgrading).</p>
  
  <p>The examples below expose the 'first name' contact field as {$billingFirstname} in the smarty templates (to be used in my ThankYou.tpl file).</p>
  
  <p>CRM/Contribute/Form/AdditionalInfo.php:</p>
  
  <p>$myvariable = CRM_Utils_Array::value( 'billing_first_name', $params );<br>
  $this->assign( 'billingFirstname', $myvariable );</p>
  
  <p>CRM/Contribute/Form/ContributionBase.php:</p>
  
  <p>$myvariable = CRM_Utils_Array::value( 'billing_first_name', $this->_params );
  $this->assign( 'billingFirstname', $myvariable );
  $this->set( 'myvariable', $myvariable );</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-11T21:09:19.153Z
Answers.LastActivityDate: 2016-04-11T21:09:19.153Z
Answers.UserDisplayName: Jacobo
Body: <p>I'm trying to edit the Thankyou.tpl smarty template to expose certain information on the Thank You page after a donation is submitted. Following the CiviCRM wiki it looks like, for instance, printing just the first name of the donor on that page should be able to be done using {$profileFields_1.first_name.value} - but this doesn't give me the result I'm looking for.</p>
  
  <p>I know that I can print the full name using {$billingName} but I need to be able to pull just the first name and a couple of other address fields. Any ideas?</p>
  
Tags: <contribution-page><smarty><templates>
Title: Thankyou.tpl fields
ThreadText: # Thankyou.tpl fields
  
  (Asked by: username_0 on 2016-04-11)
  
  I'm trying to edit the Thankyou.tpl smarty template to expose certain information on the Thank You page after a donation is submitted. Following the CiviCRM wiki it looks like, for instance, printing just the first name of the donor on that page should be able to be done using {$profileFields\_1.first\_name.value} - but this doesn't give me the result I'm looking for.
  
  I know that I can print the full name using {$billingName} but I need to be able to pull just the first name and a couple of other address fields. Any ideas?
  
  **Tags:** contribution-page, smarty, templates
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-04-11. Score: 2
  
  Add {debug} to your .tpl and you will find all available variables.
  Not all expected variables are available in all template.
  
  One way to get more variables in the .tpl file is to use the API in smarty code.
  
  More info about {debug}:
  <https://wiki.civicrm.org/confluence/display/CRMDOC/Debugging+for+developers>
  
  More info about using the API in smarty:
  <https://wiki.civicrm.org/confluence/display/CRMDOC/Smarty+API+interface>
  
  > **Comments:**
  > **username_0**: Thank you @username_1. I knew the variables weren't exposed to the template, but I wasn't aware of the options for the Smarty API. I played with it for a while and couldn't seem to get data related to just the current donation, or figure out sorting. So, I ended up adding PHP code to expose the variables to the Smarty template.  
  
  ---
  
  ### Answer by username_0 on 2016-04-11. Score: -1
  
  I ended up solving this by following existing code examples in the two files below (I know this is a hack of core files, but we are moving away from Civi and won't be upgrading).
  
  The examples below expose the 'first name' contact field as {$billingFirstname} in the smarty templates (to be used in my ThankYou.tpl file).
  
  CRM/Contribute/Form/AdditionalInfo.php:
  
  $myvariable = CRM\_Utils\_Array::value( 'billing\_first\_name', $params );  
  $this->assign( 'billingFirstname', $myvariable );
  
  CRM/Contribute/Form/ContributionBase.php:
  
  $myvariable = CRM\_Utils\_Array::value( 'billing\_first\_name', $this->\_params );
  $this->assign( 'billingFirstname', $myvariable );
  $this->set( 'myvariable', $myvariable );
  
  
  ---
  
  