I'm not sure if there is an easier way to do this, but you could
configure a MarkupRendererFilter that finds and moves your elements
before the page is written. This is how pageRenderSupport.addScript
works, sortof...

Here's something I whipped up. You could push something on the
environment to store ids instead of adding an attribute. While I ran
this, and it works, it's not guaranteed to be future proof, without
bugs or the smartest way to do the task... enjoy!

public void contributeMarkupRenderer(
                OrderedConfiguration<MarkupRendererFilter> configuration) {
        MarkupRendererFilter bodyMover = new MarkupRendererFilter() {
                public void renderMarkup(MarkupWriter writer, MarkupRenderer 
renderer) {
                        renderer.renderMarkup(writer);
                
                        Document document = writer.getDocument();
                        Element html = document.getRootElement();
                        Element body = html.find("body");
                        if (body == null) return; // no body no moving
                        processNode(html, body);
                }
                private void processNode(Node node, Element body) {
                        List<Node> children = node.getChildren();
                        for (int i = 0; i < children.size(); ++i) {
                                Node child = children.get(i);
                                if (!(child instanceof Element))
                                        continue;
                                Element element = (Element) child;
                                if (element.getAttribute("move-to-before-body") 
!= null) {
                                        children.remove(i);
                                        body.getChildren().add(child);
                                        --i; // one less element
                                } else {
                                        processNode(child, body);
                                }
                        }
                }
        };
        configuration.add("bodyMover", bodyMover);
}

On Fri, Apr 18, 2008 at 3:15 PM, Bill Holloway <[EMAIL PROTECTED]> wrote:
> I have a component that picks up a Block via
> componentResources.getBlockParameter(String).  No problem.  But I need to
> render this Block at the very bottom of the overall page, right before the
> </body>.
>
> Any thoughts?
>
> --
> Bill @ PeoplePad
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to