Hello all,
I'm having problem with the Freemarker include directive. I get an error if the included template is outside of the including file's directory. Here's a scenario: In ecommerce/includes/header.ftl I put <#include "cart/microcart.ftl"> As far as I know the "root directory of the templates" is set to HttpServletRequest.getRealPath("/"), so the filename parameter should be OK, but a TemplateException is raised: "Error reading included file..." What's wrong? Thanks for your time! </Firas> _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Firas,
I'm not sure about this, but until someone can answer definitively, I think this is set in the jpublish.xml file. Kind Regards -- Andrew Sykes <[hidden email]> Sykes Development Ltd _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
In reply to this post by Firas A.-2
Firas,
I believe Andrew is correct on this if you look in your jpublish.xml file for your app you will see the following lines: <!-- Define the root paths for pages/actions/templates --> <page-root>WEB-INF/pagedefs</page-root> <template-root>templates</template-root> <action-root>WEB-INF/actions</action-root> Mike -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Andrew Sykes Sent: Monday, November 21, 2005 9:52 AM To: OFBiz Users / Usage Discussion Subject: Re: [OFBiz] Users - Root directory of the templates Firas, I'm not sure about this, but until someone can answer definitively, I think this is set in the jpublish.xml file. Kind Regards -- Andrew Sykes <[hidden email]> Sykes Development Ltd _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Andrew, Mike
Unfortunately this wasn't it. First, those settings (except action-root) point to non-existing paths. Second, the "template root directory" is set programmatically in org.ofbiz.webapp.ftl.FreeMarkerViewHandler.init(), like this: config.setDirectoryForTemplateLoading(new File(context.getRealPath("/"))) Which means the path (in ecommerce) is: ${OFBIZ_HOME}/applications/ecommerce/webapp/ecommerce Any other thoughts? </Firas> -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Mike Baschky Sent: den 21 november 2005 17:14 To: OFBiz Users / Usage Discussion Subject: RE: [OFBiz] Users - Root directory of the templates Firas, I believe Andrew is correct on this if you look in your jpublish.xml file for your app you will see the following lines: <!-- Define the root paths for pages/actions/templates --> <page-root>WEB-INF/pagedefs</page-root> <template-root>templates</template-root> <action-root>WEB-INF/actions</action-root> Mike -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Andrew Sykes Sent: Monday, November 21, 2005 9:52 AM To: OFBiz Users / Usage Discussion Subject: Re: [OFBiz] Users - Root directory of the templates Firas, I'm not sure about this, but until someone can answer definitively, I think this is set in the jpublish.xml file. Kind Regards -- Andrew Sykes <[hidden email]> Sykes Development Ltd _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Firas,
I'm not sure what you mean? Why are the paths non-existent? Can't you just create them? Andrew On Tue, 2005-11-22 at 11:15 +0100, Firas A. wrote: > Andrew, Mike > > Unfortunately this wasn't it. First, those settings (except action-root) > point to non-existing paths. > > Second, the "template root directory" is set programmatically in > org.ofbiz.webapp.ftl.FreeMarkerViewHandler.init(), like this: > config.setDirectoryForTemplateLoading(new File(context.getRealPath("/"))) > > Which means the path (in ecommerce) is: > ${OFBIZ_HOME}/applications/ecommerce/webapp/ecommerce > > Any other thoughts? > > </Firas> > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] > On Behalf Of Mike Baschky > Sent: den 21 november 2005 17:14 > To: OFBiz Users / Usage Discussion > Subject: RE: [OFBiz] Users - Root directory of the templates > > Firas, > I believe Andrew is correct on this if you look in your jpublish.xml > file for your app you will see the following lines: > > <!-- Define the root paths for pages/actions/templates --> > <page-root>WEB-INF/pagedefs</page-root> > <template-root>templates</template-root> > <action-root>WEB-INF/actions</action-root> > > Mike > > > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] On Behalf Of Andrew Sykes > Sent: Monday, November 21, 2005 9:52 AM > To: OFBiz Users / Usage Discussion > Subject: Re: [OFBiz] Users - Root directory of the templates > > Firas, > > I'm not sure about this, but until someone can answer definitively, I think > this is set in the jpublish.xml file. > > Kind Regards > -- > Andrew Sykes <[hidden email]> Sykes Development Ltd > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users Andrew Sykes <[hidden email]> Sykes Development Ltd _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Andrew,
What I meant to say is that path settings in jpublish.xml are seem to be ignored. I've searched the whole source code (*.java) for reference to 'page-root', 'template-root' or 'action-root' but found none. I'm pretty sure these settings are hard-coded in org.ofbiz.webapp.view.JPublishWrapper.JPublishWrapper and org.ofbiz.webapp.ftl.FreeMarkerViewHandler </Firas> -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Andrew Sykes Sent: den 22 november 2005 12:39 To: OFBiz Users / Usage Discussion Subject: RE: [OFBiz] Users - Root directory of the templates Firas, I'm not sure what you mean? Why are the paths non-existent? Can't you just create them? Andrew On Tue, 2005-11-22 at 11:15 +0100, Firas A. wrote: > Andrew, Mike > > Unfortunately this wasn't it. First, those settings (except > action-root) point to non-existing paths. > > Second, the "template root directory" is set programmatically in > org.ofbiz.webapp.ftl.FreeMarkerViewHandler.init(), like this: > config.setDirectoryForTemplateLoading(new > File(context.getRealPath("/"))) > > Which means the path (in ecommerce) is: > ${OFBIZ_HOME}/applications/ecommerce/webapp/ecommerce > > Any other thoughts? > > </Firas> > > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] > On Behalf Of Mike Baschky > Sent: den 21 november 2005 17:14 > To: OFBiz Users / Usage Discussion > Subject: RE: [OFBiz] Users - Root directory of the templates > > Firas, > I believe Andrew is correct on this if you look in your jpublish.xml > file for your app you will see the following lines: > > <!-- Define the root paths for pages/actions/templates --> > <page-root>WEB-INF/pagedefs</page-root> > <template-root>templates</template-root> > <action-root>WEB-INF/actions</action-root> > > Mike > > > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] On Behalf Of Andrew Sykes > Sent: Monday, November 21, 2005 9:52 AM > To: OFBiz Users / Usage Discussion > Subject: Re: [OFBiz] Users - Root directory of the templates > > Firas, > > I'm not sure about this, but until someone can answer definitively, I > think this is set in the jpublish.xml file. > > Kind Regards > -- > Andrew Sykes <[hidden email]> Sykes Development Ltd > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users Andrew Sykes <[hidden email]> Sykes Development Ltd _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Firas,
jpublish.xml is loaded in JPublishWrapper.java, here's an excerpt... // create the site context try { //siteContext = new SiteContext(contextRoot, servletConfig.getInitParameter("config")); siteContext = new SiteContext(contextRoot, "WEB- INF/jpublish.xml"); siteContext.setWebInfPath(webInfPath); } catch (Exception e) { Debug.logError(e, "Cannot load SiteContext", module); } I guess you don't see the attributes being referenced because it's a JPublish binary that actually refers to them. Kind Regards -- Andrew Sykes <[hidden email]> Sykes Development Ltd _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Andrew,
Thank you for your time. You're of cource right about path elements beign referenced by JPublish's binary code. But as I mentioned erlier, these settings are ignored. And to make sure that I wasn't totally wrong I changed the 'action-root' path to something really invalid and restared OFBiz. After this change OFBiz (front-end/backend) was still working. As I mentioned earlier freemarker template root directory is set by a call in org.ofbiz.webapp.ftl.FreeMarkerViewHandler.init(): config.setDirectoryForTemplateLoading(new File(context.getRealPath("/"))) I guess we need the expertise of one of the gurus. My regards, </Firas> -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Andrew Sykes Sent: den 22 november 2005 15:15 To: OFBiz Users / Usage Discussion Subject: RE: [OFBiz] Users - Root directory of the templates Firas, jpublish.xml is loaded in JPublishWrapper.java, here's an excerpt... // create the site context try { //siteContext = new SiteContext(contextRoot, servletConfig.getInitParameter("config")); siteContext = new SiteContext(contextRoot, "WEB- INF/jpublish.xml"); siteContext.setWebInfPath(webInfPath); } catch (Exception e) { Debug.logError(e, "Cannot load SiteContext", module); } I guess you don't see the attributes being referenced because it's a JPublish binary that actually refers to them. Kind Regards -- Andrew Sykes <[hidden email]> Sykes Development Ltd _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
If I were making the choice I wouldn't use JPublish at all... Just use the Screen Widget. -David On Nov 22, 2005, at 10:24 AM, Firas A. wrote: > Andrew, > > Thank you for your time. You're of cource right about path elements > beign > referenced by JPublish's binary code. But as I mentioned erlier, these > settings are ignored. And to make sure that I wasn't totally wrong > I changed > the 'action-root' path to something really invalid and restared > OFBiz. After > this change OFBiz (front-end/backend) was still working. > > As I mentioned earlier freemarker template root directory is set by > a call > in org.ofbiz.webapp.ftl.FreeMarkerViewHandler.init(): > config.setDirectoryForTemplateLoading(new File(context.getRealPath > ("/"))) > > I guess we need the expertise of one of the gurus. > > My regards, > > </Firas> > > -----Original Message----- > From: [hidden email] [mailto:users- > [hidden email]] > On Behalf Of Andrew Sykes > Sent: den 22 november 2005 15:15 > To: OFBiz Users / Usage Discussion > Subject: RE: [OFBiz] Users - Root directory of the templates > > Firas, > > jpublish.xml is loaded in JPublishWrapper.java, here's an excerpt... > > // create the site context > try { > //siteContext = new SiteContext(contextRoot, > servletConfig.getInitParameter("config")); > siteContext = new SiteContext(contextRoot, "WEB- > INF/jpublish.xml"); > siteContext.setWebInfPath(webInfPath); > } catch (Exception e) { > Debug.logError(e, "Cannot load SiteContext", > module); > } > > I guess you don't see the attributes being referenced because it's a > JPublish binary that actually refers to them. > > Kind Regards > -- > Andrew Sykes <[hidden email]> Sykes Development Ltd > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users smime.p7s (3K) Download Attachment |
David,
I have stuations where I need to include small snippets of a templatized html in different places. I don't think that the overhead of Screen Widgets are justified when a simple 'include' is more than sufficient. There are also situations where I need to include templatized JavaScript files. So I need to know: How do I include templatized files outside the directory of the including template? Thank you! </Firas> -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of David E. Jones Sent: den 22 november 2005 18:30 To: OFBiz Users / Usage Discussion Subject: Re: [OFBiz] Users - Root directory of the templates If I were making the choice I wouldn't use JPublish at all... Just use the Screen Widget. -David On Nov 22, 2005, at 10:24 AM, Firas A. wrote: > Andrew, > > Thank you for your time. You're of cource right about path elements > beign referenced by JPublish's binary code. But as I mentioned erlier, > these settings are ignored. And to make sure that I wasn't totally > wrong I changed the 'action-root' path to something really invalid and > restared OFBiz. After this change OFBiz (front-end/backend) was still > working. > > As I mentioned earlier freemarker template root directory is set by a > call in org.ofbiz.webapp.ftl.FreeMarkerViewHandler.init(): > config.setDirectoryForTemplateLoading(new File(context.getRealPath > ("/"))) > > I guess we need the expertise of one of the gurus. > > My regards, > > </Firas> > > -----Original Message----- > From: [hidden email] [mailto:users- > [hidden email]] On Behalf Of Andrew Sykes > Sent: den 22 november 2005 15:15 > To: OFBiz Users / Usage Discussion > Subject: RE: [OFBiz] Users - Root directory of the templates > > Firas, > > jpublish.xml is loaded in JPublishWrapper.java, here's an excerpt... > > // create the site context > try { > //siteContext = new SiteContext(contextRoot, > servletConfig.getInitParameter("config")); > siteContext = new SiteContext(contextRoot, "WEB- > INF/jpublish.xml"); > siteContext.setWebInfPath(webInfPath); > } catch (Exception e) { > Debug.logError(e, "Cannot load SiteContext", module); > } > > I guess you don't see the attributes being referenced because it's a > JPublish binary that actually refers to them. > > Kind Regards > -- > Andrew Sykes <[hidden email]> Sykes Development Ltd > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users > > > _______________________________________________ > Users mailing list > [hidden email] > http://lists.ofbiz.org/mailman/listinfo/users _______________________________________________ Users mailing list [hidden email] http://lists.ofbiz.org/mailman/listinfo/users |
Free forum by Nabble | Edit this page |