With Apache Click 2.1.0 it includes page header element support which can provide you with a clean way of doing this. Meanwhile take a look at
http://www.avoka.com/click-examples/general/page-imports-example.htm regards Malcolm Edgar On Sat, Jun 13, 2009 at 4:06 AM, Freddy Daoud<[email protected]> wrote: > Hi gang, > > I'm trying out a basic Ajax example. > > I have an abstract BasePage with a layout.htm reusable template, with > HTML boilerplate, $cssImports, $jsImports, #parse($path) to include > the concrete page's content. > > I have a HomePage that extends BasePage and a home.htm template that > just includes the content for the page, e.g. $table. > > So far so good. > > Now, say I want to load the HomePage with an Ajax request. I issue the > request and in BasePage#getTemplate(), I return getPath() instead of > layout.htm if it is an Ajax request. > > This works beautifully! Except....that because the initial page > doesn't have a Table in it, the $*Imports don't include the CSS that > Table needs. When the Ajax request is issued, the response is only the > home.htm block, not the whole page, so the Table doesn't get to > contribute its imports to the page. > > I can add an #if in home.htm to add $*Imports for an Ajax request, but > this is a hack and also repeats any imports that are common to the > initial page and to the home page. > > Is there a cleaner solution to this problem? > > PS context.isAjaxRequest() => nice touch :) > > Thanks in advance for your help! > > Freddy > >
