I am looking at doing something that I am not sure is possible with the new modules, so if anyone has some experience or even some ideas then I would like to discuss this further.
The problem I am having is trying to get my head around calling the module, but from a defined route to begin with.
So if I develop say a community type site and it has a url like
www.domainname.com/somedefinedvar/name/admin
Now Admin is the module in question, and the name could be something like Andrew-scott or maybe andyscott or even andy-scott.
Would the module still be able to be setup in this manner?
Regards,
Andrew Scott
Regards,
Andrew Scott
http://www.andyscott.id.au/
> --
> You received this message because you are subscribed to the Google Groups
> "ColdBox Platform" group.
> To post to this group, send email to col...@googlegroups.com To
> unsubscribe from this group, send email to coldbox-
> unsub...@googlegroups.com
> For more options, visit this group at http://groups-
> beta.google.com/group/coldbox
> For News, visit http://blog.coldbox.org
> For Documentation, visit http://wiki.coldbox.org
Sent from my iPhone
> --
> You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
> To post to this group, send email to col...@googlegroups.com
> To unsubscribe from this group, send email to coldbox-u...@googlegroups.com
If in my handler I do this.
var rc = event.getCollection();
writweDump(rc); abort;
There is nothing from the original route anywhere to be seen.
Regards,
Andrew Scott
http://www.andyscott.id.au/
> -----Original Message-----
> From: col...@googlegroups.com [mailto:col...@googlegroups.com] On
1. Create an entry point to your module in the parent app. Maye like
AddModuleRoute("/mymod","modulename")
This just maps a piece of the URL to your module. Then in your actual module config create the dynamic ses route that you would like to look for.
Have you tried this?
Sent from my iPhone
The handlers will run, but the information before it is not passed over.
addModuleRoutes(pattern="/community/:name/forgebox",module="forgebox");
addRoute(pattern=":handler/:action?");
As I said if I do as you suggest the handlers are not run at all, I spent
some time going through the code line by line with the debugger. The regex
is created for the addModuleRoute, but when it comes to calling the handler
the rc is not passed over.
I'll continue to do more testing, but I can tell you know if I don't add
what I have above the handler for the Module is never executed.
Here is what I want to do
www.domainname.com/community/andyscott/module/2010/09/01
If I try this in Routes.cfc
addModuleRoute('pattern='/module', module='module);
and moduleConfig.cfc
routes = [
{pattern="/community/:name/module",
handler="manager",action="index"},
{pattern="/community/:name/module
/:year-numeric?/:month-numeric?/:day?/:blogTitle?",
handler="manager",action="dspPosts"}
];
I get community.index is not a registered event.
However if I do
addModuleRoute('pattern='/community/:name /module', module='module);
routes = [
{pattern="/ ", handler="manager",action="index"},
{pattern="/:year-numeric?/:month-numeric?/:day?/:blogTitle?",
handler="manager",action="dspPosts"}
];
Both handlers can be called fine, the only problem is that the pattern for
:name is NEVER passed over to the modules.
This is a show stopper for me now.
You are correct, the :name var is never passed in(although the docs
never say it will be) and something I'm sure we will look into(would be
a nice behavior), but it certainly doesn't have to be a show stopper.
It's not so difficult to grab that variable out of the URL yourself as
you know the pattern and place it in the request collection.
Curt Gratz
Computer Know How
Sent from my iPhone
How is it weird?
If you are expecting the :name as I am doing to be community based, how would you then apply your module across many users?
The problem I have with your solution, is will this work across multiple modules?
Regards,
Andrew Scott
http://www.andyscott.id.au/
The problem with this approach is that the normal handlers will not run, I made this very clear earlier that this was the problem.
And it will not do this for multiple modules either, which is a pain in the butt here. Here is a snapshot of what I am trying to achieve with the modules, as this is already working without them.
The site is a comunnity based site, in which the following urls will give the site details
www.domainname.com or www.domainname.com/community
From there a person can signup and create a page on this site, which then becomes
www.domainname.com/community/andyscott/
From here I can then add pages to their community space, and in this example it could be say a blog for instance
www.domainname.com/community/andyscott/blog
All the suggestions that have been put forward, then break the first 2 URL calls and will also stop any other modules from being placed onto the users space. Now I know that I can switch this to the following URL, but this is not the requirements of this site and is not acceptable.
www.domainname.com/blog/andyscott
So I hope this clears the problem up some more, and I have tried moving things around to get multiple modules working with the system handlers and nothing will work. My initial way of doing it sort of works, but it falls over because the routes that are defined are not persisted across to the module. Once that is solved then I will be back up and running again converting my core code into modules and system.
Luis, if you are interested I now have this working.
In the SES Interceptor I had to remove these lines in the findRoutes
if( NOT structIsEmpty(params) ){
return params;
}
I am not sure this is the ultimate solution, and with removing the line from the ModuleConfig
{pattern="/", handler="manager", action="index"},
It all seems to work a treat now, so at this stage I do not see any implications this will cause down the track.
From: Andrew Scott [mailto:and...@andyscott.id.au]
Sent: Saturday, 4 September 2010 8:33 AM
To: col...@googlegroups.com
Actually it does the line in the module like this
{pattern="/:year-numeric?/:month-numeric?/:day?/:Title?", handler="manager", action="displayInfo"}
Will put the following into the request collection.
_INVALID_VARIABLE_NAME_POS_1_ 09
I can live with this, but it’s something to be aware of.