Forum

Thread tagged as: Problem

Event additional fields - Showing in Admin area but not on webpage

Hi, I've followed the instructions to add a custom field (in my case a link to an external event page). For example if I have a singer who is playing at Wembley, I'd like him to be able to add the link to Wembley's site.

In events.html (i.e the master template) I have the following

`<perch:events label="Link to Event? (Optional)" type='input' id="eventLink">`

This shows up as expected in the Admin area when adding an event.

In the actual template for the page (a custom template), the following does not out the eventLink

`Event Link = <perch:events id="eventLink">`

So after the "=" is blank, i.e nothing is output to the page.

I can see in the database that the custom field has gone in OK within eventDynamicFields.

The official docs state: You can use any perch:content tags within events templates however instead of starting the field with perch:content you must start it with perch:event.

I assume this is a typo and should be perch:events?

Any pointers, sure it's a simple thing I'm missing. Thanks

Joe Proctor

Joe Proctor 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Can we see

  1. Your Diagnostics Report
  2. Your complete templates (both the master template and custom template)

It's generally a good idea to include this with each post to the forum, as otherwise we typically end up asking for them!

Diagnostics Report:-

Perch: 2.8.31, PHP: 5.6.12, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, with PDO
Server OS: Darwin, apache2handler

Installed apps: content (2.8.31), assets (2.8.31), categories (2.8.31), perch_events (1.9.3) App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_events', ); PERCH_LOGINPATH: /replaced/perch PERCH_PATH: /Applications/XAMPP/xamppfiles/htdocs/replaced/perch PERCH_CORE: /Applications/XAMPP/xamppfiles/htdocs/replaced/perch/core PERCH_RESFILEPATH: /Applications/XAMPP/xamppfiles/htdocs/replaced/perch/resources Image manipulation: GD PHP limits: Max upload 128M, Max POST 128M, Memory: 128M, Total max file upload: 128M F1: 2edba60ed1f613d6dd804feb202456a2 Resource folder writeable: Yes HTTP_HOST: localhost DOCUMENT_ROOT: /Applications/XAMPP/xamppfiles/htdocs REQUEST_URI: /replaced/perch/core/settings/diagnostics/ SCRIPT_NAME: /replaced/perch/core/settings/diagnostics/index.php

Master Template:

<div class="vevent">
<h2 class="summary"><perch:events id="eventTitle" /></h2>

<p class="dtstart"><span class="value-title" title="<perch:events id="eventDateTime" format="c" />"><perch:events id="eventDateTime" format="%c" /></span></p>

<div class="description"><perch:events id="eventDescHTML" type="textarea" textile="true" editor="markitup" encode="false" /></div>

<p class="category"><perch:events id="category_names" encode="false" /></p>

<perch:if exists="image">
    <img src="<perch:events id="image" type="image" label="Image" width="640" crop="true" />" alt="<perch:events id="eventTitle" />" />
</perch:if>

<perch:events label="Link to Event? (Optional)" type='input' id="eventLink">

</div>

Custom Template

<div class='card-event'>
<div class='card-event-left'>

    <span class="card-event-day" title="<perch:events id="eventDateTime" format="d" />"><perch:events id="eventDateTime" format="d" />
    </span>

    <span class="card-event-month" title="<perch:events id="eventDateTime" format="M" />"><perch:events id="eventDateTime" format="M" />
    </span>

    <span class="card-event-year" title="<perch:events id="eventDateTime" format="Y" />"><perch:events id="eventDateTime" format="Y" />
    </span>


</div><!--end event-left-->
<div class='card-event-right'>
    <p class='card-event-title'>
        <perch:events id="eventTitle" />
    </p>
    <p class='card-event-location'>
        <perch:events id="eventDateTime" format="h:ia" />
    </p>
    <div class='card-event-description'>
        <perch:events id="eventDescHTML" encode="false" />
    </div>

    <a href="<perch:events id="eventLink">" class='onpage-link card-event-link'>View Event Page <i class="fa fa-external-link" aria-hidden="true"></i></a>
</div><!--end card-event-right-->
</div><!--end card-event-->

Also the custom_event_type in case you may need it!

        <?php

        perch_events_custom(array(
            'count' => 3,
            'filter'=>'eventDateTime',
            'sort'=>'eventDateTime',
            'match'     => 'gte',
            'value'     => date('Y-m-d'),
            'sort-order'=>'ASC',
            'past-events' => false,
                //change category to only show public
            //'category' => array('picnics', 'concerts'),
            'template' => 'events/listing/homepage-events.html'
        ));

        ?>
Rachel Andrew

Rachel Andrew 394 points
Perch Support

So I can see your link to an event has an incorrect type - it needs to be text I think, and in double quotes.

Then you need to use the exact same tag, including the tag in the detail template.

Rachel Andrew said:

So I can see your link to an event has an incorrect type - it needs to be text I think, and in double quotes.

Then you need to use the exact same tag, including the tag in the detail template.

Thanks Rachel, still no luck. The input thing I put in there to see if it would make it work. Trying it with text and double quotes doesn't work either. I've created a new field to test it all but still no luck in displaying the custom field. So the following does not display anything on the page. However the field is shown in the admin area when creating a new event:

In the events.html template:

<perch:events label="Test Field" type="text" id="testField">

In the custom template:

        <div>Test Field = <perch:events label="Test Field" type="text" id="testField"></div>

Still results in nothing being output after "Test Field = ". If I remove the label and type attribute in the custom template it still doesn't work. Is there anyway to bypass and use the normal perch:content tags?

As a sidenote the column header in the database is 'eventDynamicFields' if that has any relevance? Further to this if I include and pull in the image, then the image does show. Technically it seems the image field is a custom field but can't see why that's working yet the testField is not.

Thanks again.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Change this:

<perch:events label="Test Field" type="text" id="testField">

to this:

<perch:events label="Test Field" type="text" id="testField" />

Oh dear! Yes that's sorted it, thought it might have been a blindingly obvious one. Many thanks for helping out.