Customizing Contribution or Profile Forms (using tpl files)

This example will allow you to change a contribution or profile page.

1. Go to a contribution page or profile on the frontend.

2. View the Source for the page.

3. Search for .tpl in the file. This will give you the path to the file to be edited. You should find something like the following line:

<!-- .tpl file invoked: CRM/Contribute/Form/Contribution/Main.tpl. Call via form.tpl if we have a form in the page. -->

4. Open the first file indicated. (In Joomla, it's under the administrator/components/com_civicrm/civicrm/ directory. In Drupal, it's under the sites/all/modules.

5. Search for the area where you want to add, remove, or change information.

6. Copy the tpl file into another directory for override purposes (e.g. custom_civicrm/CRM/Profile/Page/15 where 15 represents the profile #). Make sure to update this directory in the Resource URLs in Global Settings.

7. Turn on Debugging in Administer CiviCRM to get the Smarty information.

8. Then, use this format to layout the fields the way you would like:

{assign var=name value='First Name'}
{$name} for the label
{$row.$name} for the value

9. On Search.tpl, use this to get the help text to appear:

                <td class="description">{$form.$n.html}<br>{$fields.$n.help_post}</td>

 

 

 

Your Inbox, Our Secrets

Email:
Small Nonprofit Web Tips
Organic SEO Tips
Secret CiviCRM User Tips