I have been starting to use EventManager to create shows for a theater. I love the module and the way templating works with a Summary page, and a Detail page. It is exactly what I need.
Well I have been starting to customize the Summary and Detail templates, and I am done with the Summary template. I do have a question about the Detail template page.
You see, I have created some custom fields, and I need to call these custom fields separately, and not all of them at once.
I have created 4 custom fields:
- An image field, it's basically a thumbnail for the summary page (at the summary page you are able to see all the shows at once, with a small picture)
- Another image field, this is for the details page, a bigger picture
- A textarea field (this is an info-box on each detail page)
- A text field (here you should be able to put in a link to where you can buy tickets) (Yes I am not using any of the registration features at all!)
These fields works great, But the only problem is that I need to be able to call them separately from the details page, because right now in the Detail page Both Images are shown, I don't need the first summary image. Also I need to make a custom CSS style for the info-box, and I need to wrap the buy ticket link around a banner I've made.
My custom fields have the following aliases:
- pic-for-summary (type: image)
- pic-for-details (type: image)
- info-box (type: text-area)
- ticket-link (type: text)
How can I call them in the following code, one by one? I've tried {$entry->fields.field-alias->value} as the documentation says in the top, But it doesn't work at all, nothing is shown. At the top of the template this is commented, but I don't know if this is for the custom fields, or not:
Code: Select all
{$entry->fields : an array of extra fields
If you have an extra field with the alias "place", use :
{$entry->fields.place->value}
NOTE : sometimes, the extrafields values are arrays, so use {$entry->fields.place|print_r} to see what is availableHere is an example from the default detail template:
Code: Select all
{* Extra fields *}
{if isset($entry->fields)}
{foreach from=$entry->fields item='oneval' key='key'}
<h4>{$oneval->name}</h4>
<div>
{if $oneval->type eq 'image' and $oneval->value neq ''}
<img src="{$oneval->file_url}" style="max-width: 200px" />
{elseif $oneval->type eq 'checkboxes' and $oneval->value neq ''}
<ul>
{foreach from=$oneval->value item='onecheckbox'}
<li>{$onecheckbox}</li>
{/foreach}
</ul>
{elseif $oneval->value neq ''}
{$oneval->value}
{else}
<p>No value for {$oneval->name}</p>
{/if}
</div>
<br /><br />
{* Uncomment to display all the info for the current field : *}
{*
{$key} : {$oneval|print_r}<br /><br />
*}
{/foreach}
{/if}So, how do I call every custom field one by one, so I can wrap them around <div>'s and style them?


