Hi Joshua,
relative includes are not supported mainly for a historical reason.
Templates are primarily referenced in a Java class naming fashion ie.
getHtmlTemplate("pub.general.home"), it's only afterwards that the
path-based support has been added, ie. getHtmlTemplate("pub/general/
home.html"). I think it should be possible to added relative path
support, but only for includes. Elements already are able to reference
others with a custom 'one level up' syntax, ie.:
destid="^siblingsite.OtherElement". Something similar could be
supported for the template includes. If anyone is interested in this,
please file an issue in Jira about it.
I don't think that a custom resource finder can solve this since
resource finders don't get the context in which they should resolve a
resource name.
Take care,
Geert
On 18 Jul 2007, at 18:57, Joshua Hansen wrote:
>
> Hi Geert,
>
>> My thought was to move the contents of resources/templates down one
>> additional directory, resulting in e.g.:
>> resources/templates/en_US
>> admin
>> authentication
>> common
>> pub
>> resources/templates/en_US_PDA
>> admin
>> authentication
>> common
>> pub
>> resources/templates/fr
>> etc, etc, etc.
>>
>> I then created a MyElement to extend Element and hold the skin
>> attribute, and altered the elements to include the skin in the call
>> to
>> getHtmlTemplate(). But the jumpstart templates include other
>> templates, and I haven't yet found a way to make them relative to the
>> main template location.
>
> I'm not familiar enough with the path system in RIFE elements and
> templates. Could a custom resource finder solve this problem? Can
> templates use relative paths (i.e. "include ../common/blueprint")?
>
> Josh
> --
> Joshua Hansen
> Up Bear Enterprises
> (541) 760-7685
>
>
>
> Geert Bevin wrote:
>> Hi Dennis,
>>
>>> The intent of having a directory per skin is to put everything
>>> needed
>>> to create the UI in that skin in one place. That's easy to
>>> explain to
>>> customers, and easy to support. But it looks like making it work in
>>> RIFE means I need to find a different place than loading the
>>> element's
>>> template to identify to RIFE which directory to use. Any
>>> suggestions?
>>
>> RIFE looks up templates by default by using the classpath, however it
>> will try to use a prefix directory 'templates' in case it can't find
>> the template name as-is. So the HTML template 'pub.home' will be
>> looked up in the classpath as the resource 'pub/home.html'. If that
>> isn't found, 'templates/pub/home.html' will be tried. So for the
>> jumpstart, the 'resources' dir is part of the classpath. You can
>> create any structure and include the root in the classpath.
>>
>> In your case, the easiest would probably be to override the
>> getHtmlTemplate method of Element and prefix the name of the
>> templates
>> with skin attribute value. This should allow you to have one
>> directory
>> per skin.
>>
>> Also, the lookup of templates in the classpath is just a default
>> behavior. You could write your own resourcefinder and really
>> customize
>> resource handling completely:
>> http://rifers.org/wiki/display/RIFE/Abstracted+resource+handling
>>
>> Hope this helps,
>>
>> Geert
>>
>> --
>> Geert Bevin
>> Terracotta - http://www.terracotta.org
>> Uwyn "Use what you need" - http://uwyn.com
>> RIFE Java application framework - http://rifers.org
>> Music and words - http://gbevin.com
>>
>>
>>>
>>
>>
>
> >
--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"rife-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---