Is it possible to share layout files among applications? I mean,
having a layout file in a shared folder an make all the applications
read it while maintaining the possibility of having application-
specific layouts.
The problem with using setLayout is that if I later have to change the
path to the shared folder I have to change all references in the
handlers. Ok, I can set a variable at config level, but still...
For the default Layout I can use a relative path (it works), but not
absolute (which would be better) because it concatenates the value to
the application path.
Maybe a LayoutsExternalLocation setting can be implemented, where you could have a common shareable external layout location.
Sounds like a good idea, any more opinions, suggestions?
The only caveat with the external layouts location is that it will follow the same pattern as the view external location. The framework will try the conventions location first, if it cannot find it, it will then go to the external location.
or
: #renderExternalView('c:\........\mysharedviews\skins\1\beforeRenderView.cfm')# #renderView()# #renderExternalView('c:\........\mysharedviews\skins\1\afterRenderView.cfm')#
I already did something similar to your approach. Just that first I
declared the default layout like this:
<Layouts>
<!--Declare the default layout, MANDATORY-->
<DefaultLayout>../../common/ui/layouts/Layout.Common.cfm</
...
</Layouts>
I don't like the ../.. thing but at least it works and if needed it's
to be changed only in one place and, what it's more important, only in
the configuration file.
Then I wrote this common layout using renderExternalView to point to
the composing views (just that I use url paths and not filesystem
paths).
Well, this approach is not bad for what I intend to do but, of course,
it would be nicer to have such a way to declare views/layouts
repositories to be search in cascade.
Still what I'd like better is not having to use a relative path
(<DefaultLayout>../../common/ui/layouts/Layout.Common.cfm</
) but just an absolute one (<DefaultLayout>/common/ui/
One thing to note Jesus is that layouts and views are meant to be brought in via conventions. So having absolute paths makes no difference, because they always get pre-pended with the “AppMapping” setting.
I think the best approach is to have an externalLayouts Covention that can be used to bring in external layouts.
Any other ideas?