Am Freitag, 9. Februar 2007 14:42 schrieb Gauthier, Stephane (CH): > Hi Chris, > > Many thanks for your answer and I will investigate that way, I'm not sure > to get everything as I just started using freemarker. I have built a > special instance of magnolia which behaviour is like a wiki/blog, only one > instance no Author/Public process, the user log in then gets the editor's > facilities. So I use freemarker for generating forms (templates are > something like /mgnl-resources/myTemplate.html), ex. A button on the page > for adding a sub page, it calls a servlet -> generates the form (with > freemarker) -> process the request parameters.
Here, you might be helped by the TemplatedMVCHandler. When you define a page in magnolia, you specify the page handler class to use. As a subclass of TemplatedMVCHandler, your expected to provide a freemarker template to use. The advantage here is that your TemplatedMVCHandler can then provide logic for your template and at the same time remain neatly separated from it. You then access the page as http://myhost/magnolia/.magnolia/pages/mypagename.html or a handler method via: http://myhost/magnolia/.magnolia/pages/mypagename.html?command=someMethod there you can process the form submission. > My first issue was to get > the rights urls for my images (using shared images), then after, I was > wondering how to display request attributes within the form. > > Stéphane > > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] > Sent: Friday, February 09, 2007 1:56 PM > To: [email protected] > Subject: Re: [magnolia-user] Freemarker > > Hi Chris, > > We've been thinking about adding something along those lines for a > while (we'd need it for a forum module, for instance, or many other > dynamic apps. Would be great if we could synch our efforts ;) > > Cheers > > g > > On Feb 9, 2007, at 13:20 , Chris Miner wrote: > > on a related note. After I switched to freemarker for my template > > definitions, I still wanted to use something struts actions for > > handling page > > behavior. The PageMVCServlet works well for this. > > > > With a patch (http://jira.magnolia.info/browse/MAGNOLIA-1351) you > > can use such > > a magnolia 'page' as a template. Just replace the template path with > > something like: /.magnolia/pages/MyPage.html. Now the MyPage page > > is used as > > the template. Have a look at the TemplatedMVCHandler. > > > > Or better still, just set up your template to use freemarker the way I > > outlined previously, and then define a sub template for the > > extension '.cmd' > > or '.do' or '.action' or whatever, and set this sub template up > > with a path > > to a page that uses a subclass of the PageMVCHandler. > > > > In this way, /path/to/some/page.html is rendered with your freemarker > > template, and /path/to/some/page.cmd?command=someAction executes > > the public > > method someAction on your PageMVCHandler subclass. > > > > Now freemarker is nicely used for templating, and your related > > PageMVCHandler > > is used for adding behavior to your page. Mix in some ajax calls > > and you > > have a relatively flexible and well structured basis for extending > > Magnolia. > > > > cheers, > > Chris > > > > Am Freitag, 9. Februar 2007 12:13 schrieb Chris Miner: > >> Hi Stéphane, > >> > >> yes it is possible. One has only to write the required wrapper > >> classes. > >> However there are no fixed rules for how that should be done. The > >> wrapper > >> class interfaces are well defined, but the specifics of what the 'dot > >> notation' in a freemarker template means is determined by these > >> wrapper > >> classes. > >> > >> An example if you write ${actpage.name} in a freemarker template, > >> should > >> this return the property 'name' of the content node, or return the > >> node > >> name? Or if we use ${actpage.nodeName} what should that return? > >> All of > >> these are possible depending on how you write the wrappers. > >> > >> That said... I have written a handfull classes (9 total) that I > >> use with > >> freemarker, which I could make available. If you replace a .jsp > >> file used > >> in a template definition with an .ftl file and configure the > >> FreemarkerServlet in your web.xml to use my ContentWrapper it > >> 'just works'. > >> No additional changes needed. > >> > >> The only problem I had was that I didn't want to rewrite the cms > >> edit bar > >> tags. But that isn't really a problem. You can use the existing > >> jsp tags > >> with freemarker templates when you have to. There are only slight > >> incompatibilities. > >> > >> Perhaps through use we could improve them and reach conclusions > >> about how > >> they should work? > >> > >> Cheers, > >> Chris > >> > >> Am Freitag, 9. Februar 2007 10:19 schrieb Gauthier, Stephane (CH): > >>> Hi Magnolians, > >>> > >>> Could somebody tell me whether it's possible to get dynamically > >>> pageContext from a template page processed by freemarker and how > >>> to code > >>> it? Many thanks in advance. > >>> > >>> Cheers > >>> > >>> Stéphane Gauthier > >>> > >>> ******************************************************************** > >>> ***** > >>> ** ********* This email and any files transmitted with it are > >>> confidential > >>> and intended solely for the use of the individual or entity to > >>> whom they > >>> are addressed. If you have received this email in error, please > >>> notify > >>> the system manager ([EMAIL PROTECTED]) and delete the > >>> message with > >>> any attached files from your system. The confidentiality and > >>> integrity of > >>> this message cannot be guaranteed on the Internet and the sender > >>> does not > >>> accept liability for its content. > >>> > >>> ******************************************************************** > >>> ***** > >>> ** ******** > >>> > >>> > >>> ---------------------------------------------------------------- > >>> for list details see > >>> http://www.magnolia.info/en/magnolia/developer.html > >>> ---------------------------------------------------------------- > >> > >> ---------------------------------------------------------------- > >> for list details see > >> http://www.magnolia.info/en/magnolia/developer.html > >> ---------------------------------------------------------------- > > > > ---------------------------------------------------------------- > > for list details see > > http://www.magnolia.info/en/magnolia/developer.html > > ---------------------------------------------------------------- > > ---------------------------------------------------------------- > for list details see > http://www.magnolia.info/en/magnolia/developer.html > ---------------------------------------------------------------- > > *************************************************************************** >********* This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they are > addressed. If you have received this email in error, please notify the > system manager ([EMAIL PROTECTED]) and delete the message with any > attached files from your system. The confidentiality and integrity of this > message cannot be guaranteed on the Internet and the sender does not accept > liability for its content. > > *************************************************************************** >******** > > > ---------------------------------------------------------------- > for list details see > http://www.magnolia.info/en/magnolia/developer.html > ---------------------------------------------------------------- ---------------------------------------------------------------- for list details see http://www.magnolia.info/en/magnolia/developer.html ----------------------------------------------------------------
