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) »
  • Putting custom event fields in events with EventInfo.tpl
Pages: [1]

Author Topic: Putting custom event fields in events with EventInfo.tpl  (Read 1861 times)

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Putting custom event fields in events with EventInfo.tpl
June 29, 2009, 04:38:59 pm
The change from InlineCustomData to CustomDataView has caused my custom fields not to show (they still show in a profile block, but I want to mix the custom content in with the regular fields.).

I used to use {$groupTree.group_id.fields.$field_id.customValue.data}, which would allow me to insert the data anywhere on the EventInfo.tpl page. Now it isn't working.

If I put the event ID value into the following:
{viewCustomData.group_id.(event ID).fields.$field_id.field_value}
I can get output if I'm on the actual event page.

...any help to get the correct code would be appreciated.
« Last Edit: June 30, 2009, 08:35:52 am by joemaine »
--
Joe

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Putting custom event fields in events with EventInfo.tpl
July 01, 2009, 02:51:28 am
Try this {$viewCustomData.group_id.field_id.fields.customValueId.field_value}

Kurund
Found this reply helpful? Support CiviCRM

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Putting custom event fields in events with EventInfo.tpl
July 01, 2009, 06:32:46 am
Hi Kurund,

I tried {$viewCustomData.group_id.field_id.fields.customValueId.field_value} as:
{$viewCustomData.2.2.fields.customValueId.field_value}

which replaces the group_id (in this case 2) and the field_id (also 2)

The output will show if I use
{$viewCustomData.2.4.fields.2.field_value} (4 = the event id)
I can't seem to find the right variable name for the event id.
--
Joe

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Putting custom event fields in events with EventInfo.tpl
July 01, 2009, 07:57:03 am
This seems to work:

{assign var=eventValueId value=$event.id}
{$viewCustomData.group_id.$eventValueId.fields.field_id.field_value}

This will output the data from custom fields on the Event Information page using the template EventInfo.tpl

If the data that gets placed on your Event Information page via the
CRM/Custom/Page/CustomDataView.tpl
isn't in the format that you want; you can insert fields using the code above.
--
Joe

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Putting custom event fields in events with EventInfo.tpl
April 02, 2010, 08:02:54 am
This did work in 2.2 (see below) but is not working in 3.1:

{assign var=eventValueId value=$event.id}
{$viewCustomData.group_id.$eventValueId.fields.field_id.field_value}

am I missing some changes made to the new EventInfo.tpl or CustomDataView.tpl
--
Joe

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Putting custom event fields in events with EventInfo.tpl
April 05, 2010, 02:36:55 pm
here's a slight workaround if you want to only include fields with content instead of the table from CustomDataView.tpl

Comment out:

  {*  {include file="CRM/Custom/Page/CustomDataView.tpl"}       *}


and (anywhere on the page you like) replace with:

{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}
            
<table>
<tr><td>{$element.field_title}:</td>
   <td>{$element.field_value}</td></tr>
</table>
{/if}

         {/foreach}
         {/foreach}
         {/foreach}


I'm sure there is a more effective way to insert the individual custom fields - and it would be wonderful to select the custom data fields...but this almost works
--
Joe

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Putting custom event fields in events with EventInfo.tpl

This forum was archived on 2017-11-26.