<![CDATA[ Custom routes am I missing something??? - My Forums]]> https://forums.modx.com/thread/?thread=104610 <![CDATA[Custom routes am I missing something???]]> https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something?page=2#dis-post-562664 MODX Version: MODX Revolution 2.5.7

Hi,

Just wondered if anyone could help in the correct way when dealing with custom routes that should display data from a custom table and also have access to modx chunks, modx snippets etc. I already know how to display custom data from snippets.

creating routes is straightforward with MODX Driven content:

wwww.example.com/news - displays list of news content in cms
wwww.example.com/news/some-news-story - single news page generated in cms
wwww.example.com/news/some-news-story-2 - single news page generated in cms


However I was unsure the correct way when it comes to custom generated data:
wwww.example.com/results - displays list of results which when clicked will take you to result article from custom table
wwww.example.com/results/1 - single result page generated from custom table
wwww.example.com/results/2 - single result page generated from custom table


Is it the case am meant to create a dummy cms page to and than use query strings:
wwww.example.com/results - cms page load custom data from snippet
wwww.example.com/results?id=1 - if id 1 exists load custom data else return 404


Or is there a much better method that I missed in Docs/Forum?

Thank you




]]>
otemua Nov 12, 2018, 03:49 PM https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something?page=2#dis-post-562664
<![CDATA[Re: Custom routes am I missing something???]]> https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something?page=2#dis-post-562798 Jako Nov 17, 2018, 08:24 AM https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something?page=2#dis-post-562798 <![CDATA[Re: Custom routes am I missing something???]]> https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something?page=2#dis-post-562787 nuan88 Nov 16, 2018, 07:42 PM https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something?page=2#dis-post-562787 <![CDATA[Re: Custom routes am I missing something???]]> https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something?page=2#dis-post-562786 Quote from: nuan88 at Nov 16, 2018, 01:35 PM
He means in system settings, go to the right side at top of the Modx manager, click the gear icon, and your system settings are in there

base_url not in system settings, I tried Resource URL but that didn't seem to do anything.]]>
otemua Nov 16, 2018, 04:01 PM https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something?page=2#dis-post-562786
<![CDATA[Re: Custom routes am I missing something???]]> https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something?page=2#dis-post-562784 nuan88 Nov 16, 2018, 01:35 PM https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something?page=2#dis-post-562784 <![CDATA[Re: Custom routes am I missing something???]]> https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something#dis-post-562779 Quote from: Jako at Nov 14, 2018, 08:09 PM
The plugin uses the default modx routing settings for locating the alias. You have to set base_url system setting (or context) right, then it won't get the wrong value there.

The base path and base url is already set in \core\config\config.inc.php unless is there somewhere else I should be setting it?

Great plug-in by the way smiley you have resolved my issue]]>
otemua Nov 16, 2018, 12:05 PM https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something#dis-post-562779
<![CDATA[Re: Custom routes am I missing something???]]> https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something#dis-post-562732 Jako Nov 14, 2018, 08:09 PM https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something#dis-post-562732 <![CDATA[Re: Custom routes am I missing something???]]> https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something#dis-post-562691 Quote from: Jako at Nov 13, 2018, 11:06 AM
It should work that way.

I have updated the package for logging the found configuration together with the additional request parameters set by that configuration. The log level for invalid configurations is changed from info to error in debug mode, so you should notice those issues.

Actually I found what the issue is:

my site directory file path
C:\wamp\www\sites\example

browser url using to test plug-in
http://localhost/sites/example/results

alias setting used in plug-in
results

So $search variable is returning
"sites/example/results"
and $request['alias'] is returning just
"results"

so this part of code would always return false as no match
0 === strpos($search, $request['alias'])


by changing alias in plug-in to sites/example/results it now works

Is it possible to update the plug-in to handle this issue? as that means if you change your directory or when moving servers your have to update all your configuration settings for the plug-in.

Thanks
]]>
otemua Nov 13, 2018, 10:46 PM https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something#dis-post-562691
<![CDATA[Re: Custom routes am I missing something???]]> https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something#dis-post-562676
I have updated the package for logging the found configuration together with the additional request parameters set by that configuration. The log level for invalid configurations is changed from info to error in debug mode, so you should notice those issues.]]>
Jako Nov 13, 2018, 11:06 AM https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something#dis-post-562676
<![CDATA[Re: Custom routes am I missing something???]]> https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something#dis-post-562672 Quote from: Jako at Nov 12, 2018, 08:00 PM
Try wwww.example.com/results/1.html

Sadly still returns 404 but there is an error in the log

\core\model\modx\modx.class.php : 1613) [OnPageNotFound]string
]]>
otemua Nov 12, 2018, 09:19 PM https://forums.modx.com/thread/104610/custom-routes-am-i-missing-something#dis-post-562672