Route Question

Hello again all.

I’ve written a repository module that I want to deliver documents as if they’re subpages of an actual page on the site.

Page
Page slug: repository
Page url: [site root]/repository/

Downloadable documents

url: [site root]/repository/download/[repositoryDocumentID]

As I have it now, my module’s entry point in RepositoryModule (instead of Repository so it doesn’t override the page slug). But I can’t figure out how to set up the routes to make [site root]/repository/download/[repositoryDocumentID] point to RepositoryModule:repository.document. Thus far it looks like I can’t rely solely on the ModuleConfig to setup the route. I have created the following in config/Routes.cfm:

addRoute(pattern="/repository/document/:contentID/", moduleRouting=“repositoryModule”);

But with that done, the event that it fires is RepositoryModule:repositoryModule.index. I can’t seem to figure out what I can do to set it up to fire the correct handler and action.

Thanks in advance, and happy new year!

John

The entry point is the prefix of the url. You must account to that.

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

Luis,

Happy New Year and thanks for the response.

I am accounting for the prefix. The problem is I have a conflict with a page slug, and I want what would normally be a child of a page to actually be routed to my repository module. If I set the route at the same level as the page slug, then the page slug is never hit because my module comes up where the page should be.

But when I try to set the route ( addRoute(pattern="/repository/document/", moduleRouting=“repositoryModule”, handler=“repository”, action=“document” ); ), the handler and action are ignored when the event is determined. If I change the module entry point in the ModuleConfig to try to point it to the desired handler and action, it still points to the wrong handler and action. Is there no way to set a handler and action specific to a route without having the parent folder need to be a generic module entry point?

My issue is that I want to specify a specific handler and action, but the route setting is ignoring these and still simply

Ok, here is what I have worked out (for those who might find it useful knowledge).

/config/Routes.cfm
Add the application route:
addRoute(pattern="/repository/document/:documentID", moduleRouting=“repositoryModule”);

ModuleConfig.cfc
Change the module entry point to the specific route and action desired (can’t get around using the entry point for the specific event):
{pattern="/", handler=“repository”,action=“document”},

I would have preferred to have a solution that completely came from within the ModuleConfig and didn’t require changing the module entry point as I have other parts of the module in the admin section, but that’s what works.

I might not be understanding. Would probably need more info to test. As each module can register any external entry point.

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

The problem arises when what should be the entry point (to allow for the handler and action to be the subfolders in the url) is already a page slug. So then the entry point needs to be a level down from where it should be.

You are saying that if I create an entry point called “About” and hit /about it thinks it is a page?

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox