On Tue, 2012-01-03 at 09:19 -0500, Paul Joseph wrote: > Hi there, > > I know that I can call a function with parameters using the sitemap as > for ex.: > > <map:flow language="javascript"> > <map:script src="myApplication.js"/> > </map:flow> > <map:pipelines> > <map:pipeline> > <map:match pattern="index.html"> > <map:call function="showIndexPage"> > <map:parameter name="paramName" value="Value"/> > </map:call> > </map:match> > </map:pipeline> > </map:pipelines> > > and: > > Then in myApplication.js you would define a JavaScript function called > showIndexPage() such as: > > function showIndexPage() { var param = cocoon.parameters.paramName; > sendPage("private/index.html", {param: param}); } > > > > But how would I use this to call a function whose arguments are in the > calling URL. > > Ex. say I wanted to login any user where the user's name is specified in > the URLhow could I do this? For example if I wanted to call a function > using the user's login name that I specify in the URL (say the user is > jsmith), and I used a URL as below, how would I pass on jsmith on to the > flowscript?: > > Ex.: http://myserver:8080/myApp/login/jsmith
Depends a bit on your version of cocoon but the following will work in all version (replace {1} with {map:1} for c3). <map:flow language="javascript"> <map:script src="myApplication.js"/> </map:flow> <map:pipelines> <map:pipeline> <map:match pattern="index.html"> <map:call function="showIndexPage"> <map:parameter name="paramName" value="Value"/> </map:call> </map:match> <map:match pattern="login/*"> <map:call function="login"> <map:parameter name="user" value="{1}"/> </map:call> </map:match> </map:pipeline> </map:pipelines> HTH salu2 -- Thorsten Scherler <thorsten.at.apache.org> codeBusters S.L. - web based systems <consulting, training and solutions> http://www.codebusters.es/ --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org For additional commands, e-mail: users-h...@cocoon.apache.org