Re: [Pas-dev] Re: PAS include file directive
Status: Beta
Brought to you by:
mortis
From: Justin B. <ju...@le...> - 2004-01-26 23:59:45
|
>> After reviewing the code more last night, the include file directive >> could almost be made to happen at runtime... we'd just need access to >> a compiler (isn't it already there in the RequestHandler?). The >> resolveIncludeFile method could be moved to Org::Bgw::Pas::Page.pm or >> Org::Bgw::Pas::Base.pm. That method would pretty much remain the same >> except it would compile the file it finds and return the results. > > If you're talking about resolving includes every time a page is > accessed, you should also keep in mind that that is counter to the point > of mod_perl, and in some circumstances the compiled pages will be in > memory as a previous version already. > > I think you might be suprised at runtime by certain undesired behavior. Considering the majority of the content of the included pages will be executed at runtime... I'd say I have the blinders on. :) I guess then what I'm asking for is a dynamic include vs the static include. Just like in JSP's: -- With JSP, there are two different kinds of content to include: static and dynamic. The include directive shown here: <%@ include file="include/copyright.inc" %> includes the source of the target page at translation/compile time. Therefore, it's not possible to include runtime content using the include directive. The JSP include directive treats a resource as a static object, and the context of the resource is included literally in the page. In direct contrast, the include action shown here: <jsp:include page="include/copyright.inc"/> handles the resource as a dynamic object. The request is sent to the resource, and the result of the processing is included. Templates use a dynamic approach so that runtime expressions can be evaluated and included. -- More on the <jsp:include> tag: http://java.sun.com/products/jsp/tags/11/syntaxref1112.html That's what I'm basically looking for/to do. Where you can pass an expression as the page name. And just for reference: http://java.sun.com/products/jsp/tags/11/syntaxref117.html#8772 (Include directive) > You could always do as kyle mentioned jsp does and use a uri style > include, or you could forward to a different psp based on the $criteria > in the page. I'd like to keep maintenance to a minimum therefore I would rather not completely copy an entire page like I would have to do with a forward. I'd rather have more of the flexibility of Jakarta Stuts in particular Tiles: http://jakarta.apache.org/struts/userGuide/dev_tiles.html I'm basically talking about solution 5 on this page: http://www.javaworld.com/javaworld/jw-01-2002/jw-0104-tilestrut.html. I'd like to reduce the coupling between common view components and content bodies. This not only helps reduce maintenance under one instance but also across instances. It would also allow clients to have a little more freedom for body content or even layout w/o significantly impacting maintenance and even development time. > Just some half baked ideas. Would we expect any less? :) If we add a new tag that has the similar functionality as <jsp:include> (at least the dynamic part) we'd at least be moving towards the direction of Tiles. Using the configuration file to choose the right layout and page and the page object have the ability to override those choices is a nice start, IMO. Maybe not ideal or as straight forward, but after working with Jakarta Struts and Tiles, I wouldn't consider that straight forward either. Justin |