<![CDATA[ How to solve EventsX Url - My Forums]]> https://forums.modx.com/thread/?thread=104960 <![CDATA[How to solve EventsX Url]]> https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564385
 $event['url'] = $modx->makeUrl($eventsPage).urlencode($event['name']).'/'.$event['id'];
.

Just not sure what format EventsX is expecting $modx->makeUrl($eventsPage) to be in in order to append '/'.$event['id'];

]]>
lancipoos Mar 12, 2019, 10:30 AM https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564385
<![CDATA[Re: How to solve EventsX Url]]> https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564452
The fact that you still saw the preg_match() error means that the error-log code I suggested is not above the first bad preg_match() code. If it were, the error log would show the $eventsPageRegex value, which we now know contains '/c' since changing the delimiter solved things.]]>
BobRay Mar 14, 2019, 06:39 PM https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564452
<![CDATA[Re: How to solve EventsX Url (Best Answer)]]> https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564446 PHP warning: preg_match(): Unknown modifier 'c' like I posted before.

Personally I'm no expert with preg_match, but it turns out the / at the beginning and end of the regular expression are causing the issue. Using # as a delimiter instead fixes the issue.

In the Plugin 'EventsX, changing
elseif ($modx->event->name == 'OnPageNotFound' && preg_match('/'.$eventsPageRegex.'\/.*\/[0-9]+$/', $_SERVER['REQUEST_URI']))

to
elseif ($modx->event->name == 'OnPageNotFound' && preg_match('#'.$eventsPageRegex.'\/.*\/[0-9]+$#', $_SERVER['REQUEST_URI']))


and in the evxEvent snippet, changing
if(preg_match('/'.$eventsPageRegex.'\/.*\/[0-9]+$/', $_SERVER['REQUEST_URI']))

to
if(preg_match('#'.$eventsPageRegex.'\/.*\/[0-9]+$#', $_SERVER['REQUEST_URI']))


sorts it. Now it all works!!

Trying to solve this has highlighted a whole bunch of preg_match errors thrown by the Glossary extra mentioned half a year ago in this post
https://forums.modx.com/thread/104497/how-to-sort-snippet-array-alphabetically#dis-post-562109
so maybe that might fix the error there too.

]]>
lancipoos Mar 14, 2019, 12:02 PM https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564446
<![CDATA[Re: How to solve EventsX Url]]> https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564427
$modx->log(modX::LOG_LEVEL_ERROR, 'EVENTS PAGE REGEX: ' . $eventsPageRegex);


Then check the error log for a value with a slash followed by the letter c.]]>
BobRay Mar 13, 2019, 06:36 PM https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564427
<![CDATA[Re: How to solve EventsX Url]]> https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564424
I wonder whether your comment on the other post 3 years ago might be the way to go, use some other method & just redirect to the event detail directly.]]>
lancipoos Mar 13, 2019, 05:12 PM https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564424
<![CDATA[Re: How to solve EventsX Url]]> https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564421
The key may be the value of $eventsPageRegex. If it has an unescaped forward slash followed by the letter 'c', that would explain the error message you're getting.]]>
BobRay Mar 13, 2019, 04:47 PM https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564421
<![CDATA[Re: How to solve EventsX Url]]> https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564409
Modx error log shows:
public_html/core/cache/includes/elements/modplugin/18.include.cache.php : 62) PHP warning: preg_match(): Unknown modifier 'c' 


Line 62 being:
elseif ($modx->event->name == 'OnPageNotFound' && preg_match('/'.$eventsPageRegex.'\/.*\/[0-9]+$/', $_SERVER['REQUEST_URI']))


Server access logs show:
 "GET /calendar-test-page/calendarupcomingevents/TestEvent/1 HTTP/1.1" 404 24521 


Checking server PHP version, it's old
PHP 5.5.9-1ubuntu4.22

Thanks]]>
lancipoos Mar 13, 2019, 11:15 AM https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564409
<![CDATA[Re: How to solve EventsX Url]]> https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564402 Just not sure what format EventsX is expecting $modx->makeUrl($eventsPage) to be in in order to append '/'.$event['id'];
You've already found the partial answer to that in the instruction #6, but that line expects your $eventsPage to be a resource container, so that the friendly url ends in / instead of .html]]>
markh Mar 12, 2019, 08:58 PM https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564402
<![CDATA[Re: How to solve EventsX Url]]> https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564397 BobRay Mar 12, 2019, 07:23 PM https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564397 <![CDATA[Re: How to solve EventsX Url]]> https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564388 https://docs.modx.com/extras/revo/eventsx says
4. Create a resource for the events calendar (or add it to your template(s))
5. Create a resource for the upcoming events list (see template example below)
6. Create a resource below that for a single event (see template example below)

See on '6' it says 'below that'. It means a child page of 5. Missed that.

We also came across a post from Wallaco from 3 years back:
https://forums.modx.com/thread/97779/onpagenotfound-not-firing-unless-debug-added-for-eventsx
Seems like the same issue. As mentioned there, URLs should be in the format:
Summary resource URL: http://domain.com/events/
Detail resource URL: http://domain.com/events/Some+Event/2
with the detail resource then using
$modx->sendForward($eventPage);
to forward the request URL and parameters to the single event page.

We found a couple of things. As the other post says, the plugin uses a OnPageNotFound.
if ($modx->event->name == 'OnPageNotFound' && preg_match('/'.$jsonURI.'\?.*$/', $_SERVER['REQUEST_URI']))

works fine and spits out a calendar page.
After the 'if' comes an elseif for the events pages
elseif ($modx->event->name == 'OnPageNotFound' && preg_match('/'.$eventsPageRegex.'\/.*\/[0-9]+$/', $_SERVER['REQUEST_URI']))

This doesn't work and comes up with an error
PHP warning: preg_match(): Unknown modifier 'c'

If you override the elseif with a straight forward 'else'
else { $modx->sendForward($eventPage);
}

that fires, but the 'Some+Event/2' get stripped from http://domain.com/events/Some+Event/2 link and you just end up seeing the resource URL: http://domain.com/events/

Any ideas, folks?
]]>
lancipoos Mar 12, 2019, 04:16 PM https://forums.modx.com/thread/104960/how-to-solve-eventsx-url#dis-post-564388