Forum

Thread tagged as: Events, Problem

Event App in Perch 3: custom template not visible

My custom template «event.html» is in the proper folder (/perch/templates/events/event.html). The markup written by Perch is also correct. But, I can't see it in the editing area...there is another one with the fields: Name - Description - Date - Category. My app.php looks like that:

<?php
    $apps_list = array(
        'content',
        'categories',
        'perch_events',
    );
?>

And finally how it is called in the page:

<?php
                            perch_events_custom(array(
                                'filter'=>'eventDateTime',
                                'match'=>'gte',
                                'value'=>date('Y-m-d'),
                                'sort'=>'eventDateTime',
                                'sort-order'=>'desc',
                                'template'=>'event.html'
                            ));
                        ?>

Any idea where my fault is? Thanks a lot!

Martin Stettler

Martin Stettler 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

If you turn on debug, it should output the details of all the templates that are being used. What does it say about it?

So far it seems to be correct, the output is:

Using template: /templates/events/event.html

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show us your template?

Here it is:

<perch:before><ul class="event-list"></perch:before>

    <li class="list-unstyled">

        <div class="row">

            <perch:if different="eventDateTime" format="%B">
                <div class="col-sm-12">

                    <h4 class="eventMonth"><perch:events id="eventDateTime" format="%B" /></h4>

                </div>
            </perch:if>

            <div class="col-xs-12 col-sm-6 event">
                <p class="eventDateTime"><perch:events id="eventDateTime" format="%a, %d.%m.%Y" />, <perch:events id="eventDateTime" format="%H.%M Uhr" /> </p>
                <h3 class="eventTitle"><perch:events id="eventTitle" /></h3>
            </div>

            <div class="col-xs-12 col-sm-6 eventURLs">

                <perch:if exists="link">
                    <a class="event-btn" href="<perch:content id="organizer" type="text" label="Veranstalter" />">
                    </perch:if>

                    <perch:content id="organizer" type="text" label="Veranstalter" required title>

                    <perch:if exists="link">
                    </a>
                </perch:if>

                <perch:if exists="link">
                    <a class="event-btn" href="<perch:content id="organizer" type="text" label="Vorverkauf" />">
                    </perch:if>

                    <perch:content id="booking" type="text" label="Vorverkauf" required title>

                    <perch:if exists="link">
                    </a>
                </perch:if>

            </div>

        </div>

    </li>

<perch:after></ul></perch:after>

Thanks a lot for having a look, Drew!

Drew McLellan

Drew McLellan 2638 points
Perch Support

You're using perch:content tags in an Events template. You should change them to perch:events to match the existing tags.

So far ok, I can see now the a-tags. But unfortunately I still have a description tag and a categorie headline in the template output... What is still wrong? Thanks again!

Drew McLellan

Drew McLellan 2638 points
Perch Support

Where in relation to the content in the template?

The output in the markup is fine. But the fields in the editing area are the following: 1. Name (says «required») 2. Description (which I don't use) 3. Date 4. my custom fields for eventURLs 5. Categories (only the headline) The order is also wrong, it should be date - title - custom fields. I left the IDs the same in my custom template as you see above. Maybe it helps to show you the whole debug message:

Debug Message - Perch 3.1.1
[1] SELECT u.*, r.* FROM perch3_users u, perch3_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='adff104bbec2a6ba85c06c42f28ac568' LIMIT 1
UPDATE perch3_users SET userHash='3a7c7f778ef5d56be3a5e700edc1ff7f' WHERE userID='1'
[23] SELECT settingID, settingValue, userID FROM perch3_settings WHERE userID=1 OR userID=0 ORDER BY userID ASC
[8] SELECT itemValue FROM perch3_menu_items WHERE itemType='app'
[nil] SELECT * FROM perch3_events_categories ORDER BY categoryTitle ASC
[1] SELECT * FROM perch3_events WHERE eventID = 1
[nil] SELECT categoryID FROM perch3_events_to_categories WHERE eventID = 1
[nil] SELECT c.* FROM perch3_events_categories c, perch3_events_to_categories e2c WHERE c.categoryID=e2c.categoryID AND e2c.eventID='1'
Using template: /templates/events/event.html
[1] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=0 ORDER BY itemOrder ASC LIMIT 0, 1
[3] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=1 ORDER BY mi.itemOrder ASC
[1] SELECT itemTitle FROM perch3_menu_items WHERE itemType='app' AND itemValue='perch_events' LIMIT 1
[1] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=0 ORDER BY itemOrder ASC LIMIT 1, 10
[2] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=2 ORDER BY mi.itemOrder ASC
File: /addons/apps/perch_events/modes/edit.post.php
Queries: 14
Memory: 3,3494

Your help is much appreciated!

Duncan Revell

Duncan Revell 78 points
Registered Developer

Hi Martin,

the Events app is quite an old app - it hasn't been updated to the much newer Perch style of creating all admin fields through templates. The name, description and category fields are hard-coded in the app code to always appear - you can't turn them off.

Well, you can turn them off by editing the Events app files - and as the Events app is highly unlikely to be updated (by the Perch team), you are probably safe to do so.

Hi Duncan

Thank you for your reply!