We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44007
    • 15 Posts
    I don't know whether this is directly related to EventsX, or whether it's a general MODx oddity.

    MODx version is 2.3.3 running on CloudLinux and PHP 5.5, with EventsX installed (no longer supported, I expect) and friendly URLs enabled.

    Background info:
    EventsX uses a plugin which runs on detection of the OnPageNotFound event. This plugin determines whether to show the 'summary' list of events page, or the 'detail' page for an event by inspecting the URL.

    Summary resource URL: http://domain.com/events/
    Detail resource URL: http://domain.com/events/Some+Event/2

    The Summary resource is a single valid resource, and displays as expected.
    There is no specific resource at the event detail URL, instead the OnPageNotFound handler should fire, set placeholders and redirect to a single event detail resourceId (so, one resource for summary, one resource for detail).

    The only way I can get the plugin to run when the detail resource is requested is by adding some debug to the EventsX plugin script:

    $modx->log(modX::LOG_LEVEL_ERROR, '404: URI: '.$_SERVER['REQUEST_URI']);


    With that in the plugin script, everything works as I would expect. Remove it, and navigating to the event detail page (which has no resourceId and should trigger the OnPageNotFound event) results in the events summary being displayed instead.

    My question is, why would the addition of a simple line of debug make a difference to processing and event handling?

    This question has been answered by BobRay. See the first response.

    • discuss.answer
      • 3749
      • 24,544 Posts
      That's a really interesting question. Offhand, I can't think of a good answer.

      I think you might have better luck with a snippet on the events summary page that checks the URL and either returns '' or redirects to the appropriate page based on the URL.

        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 44007
        • 15 Posts
        Well I'm glad I'm not alone.

        That's an interesting alternative approach though, and a bit less fudge-like. Also removes some unnecessary processing for 90% of other page requests.

        Cheers Bob.