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 CiviEvent (Moderator: Yashodha Chaku) »
  • Custom Event Data
Pages: [1]

Author Topic: Custom Event Data  (Read 435 times)

jgregory

  • I post occasionally
  • **
  • Posts: 55
  • Karma: 1
  • CiviCRM version: 4.5.3
  • CMS version: Drupal 7.34
  • MySQL version: 5.5.40
  • PHP version: 5.3.29
Custom Event Data
September 14, 2012, 10:42:06 am
I have created several custom fields for events that appear on the event registration page. That has worked just like I want it to. However, I now want to record some custom event data that I do not want people to see on the event registration page. I have played a little with custom tpl files. However, I don't know enough to make some of my custom event data appear on the registration page and some not to appear.

I have been playing with a couple files:
CRM/Event/Page/EventInfo.tpl
CRM/Custom/Page/EventCustomDataView.tpl

I'd like to create a custom EventCustomDataView.tpl file that looks like this...

   <div class="label">{$element.field_title}</div>
   <div class="content">
   <div class="crm-section event_summary-section">{$element.field_value}</div>
   </div>

And iterate through the fields I want to include; but I don't know what to put here (element.field_title) or here (element.field_value).

Am I on the right track. Any suggestions?

- Noob John
« Last Edit: September 14, 2012, 12:48:01 pm by jgregory »

Jeroen~

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • WoesteLand
  • CiviCRM version: CiviCRM 4.2
  • CMS version: Drupal 7
Re: Custom Event Data
September 15, 2012, 01:28:54 pm
In eventinfo.tpl I inserted for my site some code to ad some pictures based on info form custom fields.
Here is the code I use (I'm not really a coder, but it works)
Code: [Select]
{crmAPI var="EventS" entity="Event" action="get" sequential="1" id=$event.id}
{foreach from=$EventS.values item=Custom}
{foreach from=$viewCustomData item=customValues key=2}
{foreach from=$customValues item=cd_edit key=2}                     
{foreach from=$cd_edit.fields item=element key=2}       
{if $element.field_value}
{if $element.field_title=="land"}
<div class="{$Event.custom_23}">
<img width="50" title="{$element.field_value}" src="../../sites/all/themes/S2Woesteland/css/images/icons/icoon.png">
</div>
{/if}
{/if}
{/foreach}
            {/foreach}
        {/foreach}
{/foreach}

jgregory

  • I post occasionally
  • **
  • Posts: 55
  • Karma: 1
  • CiviCRM version: 4.5.3
  • CMS version: Drupal 7.34
  • MySQL version: 5.5.40
  • PHP version: 5.3.29
Re: Custom Event Data
September 17, 2012, 11:50:03 am
Thanks Grootte. Your example helped. I got it worked out using the following code for CRM/Custom/Page/EventCustomDataView.tpl

Code: [Select]
{assign var="showEdit" value=1}
{foreach from=$viewCustomData item=customValues key=customGroupId}
{foreach from=$customValues item=cd_edit key=cvID}
{foreach from=$cd_edit.fields item=element key=field_id}
<div class="crm-section event_date_time-section">
{if $element.field_title=="Instructor(s)"}
<div class="label">{$element.field_title}</div>
<div class="content">
<div class="crm-section event_summary-section">{$element.field_value}</div>
</div>
{/if}
{if $element.field_title=="Day and Time"}
<div class="label">{$element.field_title}</div>
<div class="content">
<div class="crm-section event_summary-section">{$element.field_value}</div>
</div>
{/if}
{if $element.field_title=="Dates"}
<div class="label">{$element.field_title}</div>
<div class="content">
<div class="crm-section event_summary-section">{$element.field_value}</div>
</div>
{/if}
{if $element.field_title=="Minimum Age"}
<div class="label">{$element.field_title}</div>
<div class="content">
<div class="crm-section event_summary-section">{$element.field_value}</div>
</div>
{/if}
</div>
{/foreach}
<div class="clear"></div>
{/foreach}
{/foreach}

Jeroen~

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
    • WoesteLand
  • CiviCRM version: CiviCRM 4.2
  • CMS version: Drupal 7
Re: Custom Event Data
September 17, 2012, 12:31:31 pm
I'm glad I could help you.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Custom Event Data

This forum was archived on 2017-11-26.