Forum

Thread tagged as: Problem, Addons, Events

Events past-events false but still showing up

Perch: 2.8.34, PHP: 5.6.30, MySQL: 5.6.33, with PDO Server OS: Linux, cgi-fcgi Installed apps: content (2.8.34), assets (2.8.34), categories (2.8.34), perch_events (1.9.3) App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_events', ); PERCH_LOGINPATH: /tof_update PERCH_PATH: /home/medd1492/public_html/tof_update PERCH_CORE: /home/medd1492/public_html/tof_update/core PERCH_RESFILEPATH: /home/medd1492/public_html/tof_update/resources Image manipulation: GD Imagick PHP limits: Max upload 2M, Max POST 8M, Memory: 128M, Total max file upload: 2M F1: 6a33f95eca3667f9e0c39bf5ca2980fe Resource folder writeable: Yes SCRIPT_NAME: /tof_update/core/settings/diagnostics/index.php REQUEST_URI: /tof_update/core/settings/diagnostics/ DOCUMENT_ROOT: /home/medd1492/public_html HTTP_HOST: tasteofflavor.net ~~ <?php $opts = array( 'past-events' => false, 'category' => array('festivals', 'special'), 'sort'=>'eventDateTime', 'sort-order'=>'ASC', 'event-day-template'=>'events/event.html', ); perch_events_custom($opts); ?> ~~ Why are the past-events still showing up on the page?

Carol Swinehart

Carol Swinehart 0 points

  • 4 years ago
Simon Clay

Simon Clay 127 points

Hi Carol,

Looking at the docs, perch_events_custom() doesn't appear to accept the past-events parameter.

perch_events_listing($opts); might be better instead.

Simon Clay said:

Hi Carol,

Looking at the docs, perch_events_custom() doesn't appear to accept the past-events parameter.

perch_events_listing($opts); might be better instead.

Using the perch_events_listing($opts) adds a different problem How do I get rid of the navigation that shows up on the page. ~~ <ul class="calendar-nav"> <li><a class="paging-prev" href="?d=2017-04"> Apr 2017</a></li> <li><a href="?d=2017-05">*</a></li> <li><a class="paging-next" href="?d=2017-06">Jun 2017 </a></li> </ul> ~~ That might not be a back solution but the items don't show up for April so that has to go. Anyone know where that is in which template I can not find it in the events_lisiting templates? Any suggestions are most appreciated.

Simon Clay

Simon Clay 127 points

Actually, we can filter from today's date so, switching back to perch_events_custom() adding the an extra 2 lines, this should work:

<?php 
                $opts = array( 
                    'past-events' => false, 
                    'category' => array('festivals', 'special'), 
                    'sort'=>'eventDateTime', 
                    'sort-order'=>'ASC', 
                    'event-day-template'=>'events/event.html',                  
// These extra parameters will remove past events
                    'filter'=>'eventDateTime',
                    'value'=>date("Y-m-d") . ', 2099-12-31', 
            );
                perch_events_custom($opts);
            ?>
Rachel Andrew

Rachel Andrew 394 points
Perch Support

To see which template is being used enable Perch Debug, it will tell you.

This is the debug message that comes up when I go to the events.php page in my admin. I do not see the template address listed. Is it there? What am I doing wrong? ~~ SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='9ffbedaa507fe52bb58fc968257b488e' LIMIT 1 UPDATE perch2_users SET userHash='3d4cb7b87bf15f658b3ff16480556600' WHERE userID='1' [28] SELECT p.privKey FROM perch2_user_privileges p [18] SELECT * FROM (SELECT DISTINCT settingID, settingValue, userID FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID, settingValue, userID [1] SELECT * FROM perch2_pages WHERE pageID=5 LIMIT 1 [4] SELECT * FROM perch2_content_regions WHERE pageID=5 AND regionPage!='' ORDER BY regionOrder ASC [1] SELECT COUNT() FROM perch2_content_items WHERE itemJSON!='' AND regionID=57 AND itemRev=1 [1] SELECT COUNT() FROM perch2_content_items WHERE itemJSON!='' AND regionID=58 AND itemRev=1 [1] SELECT COUNT() FROM perch2_content_items WHERE itemJSON!='' AND regionID=59 AND itemRev=1 [0] SELECT COUNT(*) FROM perch2_content_items WHERE itemJSON!='' AND regionID=60 AND itemRev=0 Queries: 11 Memory: 2.3918> ~~ Rachel Andrew said: >

To see which template is being used enable Perch Debug, it will tell you.

Simon Clay

Simon Clay 127 points

Hi Carol, you should be able to go back to perch_events_custom with the code I've shown above.

Drew McLellan

Drew McLellan 2638 points
Perch Support

That looks like debug from the control panel, which won't tell you anything about what's happening with the code on your page. You need to look at the debug on your page.

Simon Clay said:

Hi Carol, you should be able to go back to perch_events_custom with the code I've shown above. Causes a 505 error on my server. Nothing comes up.

Simon Clay

Simon Clay 127 points

sorry edited now...

<?php 
    $opts = array( 
    'past-events' => false, 
    'category' => array('festivals', 'special'), 
    'sort'=>'eventDateTime', 
    'sort-order'=>'ASC', 
    'event-day-template'=>'events/event.html', 
    // These extra parameters will remove past events 
    'filter'=>'eventDateTime', 
    'value'=>date("Y-m-d") . ', 2099-12-31', 
    ); 

    perch_events_custom($opts); 
    ?>

I don't get a 505 error but the events do not show up at all.

Drew McLellan said:

That looks like debug from the control panel, which won't tell you anything about what's happening with the code on your page. You need to look at the debug on your page.

Page debug does not show template as far as I can see but I still need to get the nav code out of there

Debug Message ~~ [16] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/events.php' OR regionPage='*' ORDER BY regionPage DESC ~~ Here is what is displayed on the page

May 2017

Starting here is what I want to get off the page Apr 2017 * Jun 2017 Ends here

Saturday, May 06, 2017 -May 7, 2017 Newark Soccer Tournament Location: Time: All Day

Friday, May 12, 2017 Englefield Oil Newark Lunch Location: 447 James Pkwy, Heath, OH 43056 Time: All Day

Friday, May 19, 2017 Job & Family Services Lunch Location: 239 W Main St, Lancaster, OH 43130 Time: 11 am - 2 pm

I think to get the filter to work you need to add the match parameter to perch_events_custom so:

    'filter'=>'eventDateTime',
    'match'=>'gte',
    'value'=>date('Y-m-d H:i:s'),

Thank you, Robert that worked.