You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jspwiki.apache.org by Mike Morris <mi...@gmail.com> on 2009/02/26 08:39:46 UTC

Access to jspwiki.properties in templates?

I've been working on a template-set that I'm using for a multiple wiki
situation. It's a very light mod of the standard templates, such that
the View template looks something like an ordinary (non-editable)
website, except for authenticated users.

One thing that I want/need is to have different favicons, banner
pictures, etc. for the different sites. So far I've hacked a
workaround based on using the jspwiki.applicationname (which differs
for each wiki) but its an ugly, fragile and brittle hack. Ideally I
would like to add some properties of my own invention to the various
jspwiki.properties files, and then pick them up in the templates. Is
there any way to do this that I may (likely) have missed? Some of the
documentation wiki seems to imply that this is possible, but the
details elude me.

-- 
This email is [X]bloggable [ ]ask-first [ ]private

Mike Morris
http://mikro2nd.net/
EarthStuff: http://mikro2nd.net/blog/planb/
TechStuff: http://mikro2nd.net/blog/mike/

----- A day without chillies is a day wasted ------

Re: Access to jspwiki.properties in templates?

Posted by Janne Jalkanen <ja...@ecyrd.com>.
On 27 Feb 2009, at 09:28, Mike Morris wrote:

> 2009/2/26 Janne Jalkanen <ja...@iki.fi>:
>
>> [{$jspwiki.propertyName}].  Therefore, VariableTag works too.
>
> Wouldn't that only work in wikipage __content__, since the [{...}]
> syntax doesn't apply inside templates? I need it inside the templates
> themselves.

<wiki:Variable var="jspwiki.propertyName"/> ;-)

/Janne

Re: Access to jspwiki.properties in templates?

Posted by Mike Morris <mi...@gmail.com>.
2009/2/26 Janne Jalkanen <ja...@iki.fi>:

> [{$jspwiki.propertyName}].  Therefore, VariableTag works too.

Wouldn't that only work in wikipage __content__, since the [{...}]
syntax doesn't apply inside templates? I need it inside the templates
themselves.

Would be very cool to be able to define arbitrary values in
jspwiki.properties and having them accessible in (at least) templates!

I know that part of this could be solved by fiddling with resource
bundles, but they're stuck away inside the jarfile, and I was trying
to avoid having to rebuild the jarfile, since that means more work for
every version upgrade. It would be (IMHO) make hacking templates much
more accssible if the resource bundles were outside the jarfile, but
that's a new topic... ;-)

-- 
This email is [X]bloggable [ ]ask-first [ ]private

Mike Morris
http://mikro2nd.net/
EarthStuff: http://mikro2nd.net/blog/planb/
TechStuff: http://mikro2nd.net/blog/mike/

----- A day without chillies is a day wasted ------

Re: Access to jspwiki.properties in templates?

Posted by Janne Jalkanen <ja...@iki.fi>.
Some of the properties can also be accessed through wikivariables.

[{$jspwiki.propertyName}].  Therefore, VariableTag works too.

Caveat: this only works for properties which start with the tag
"jspwiki.".  This is something I would like to reverse for 3.0, since
as a security measure it's pretty dumb.

/Janne

On Thu, Feb 26, 2009 at 03:17:08PM +0200, Mike Morris wrote:
> 2009/2/26 Murray Altheim <mu...@altheim.com>:
> >
> > In WikiEngine:
> >
> >     public Properties getWikiProperties()
> 
> Darn, I was hoping to avoid scripty stuff :-P was hoping there'd be a
> suitable tag or something. Thanks much for the clue, though: its still
> less of a hack than what I have at present! :-D
> 
> -- 
> This email is [X]bloggable [ ]ask-first [ ]private
> 
> Mike Morris
> http://mikro2nd.net/
> EarthStuff: http://mikro2nd.net/blog/planb/
> TechStuff: http://mikro2nd.net/blog/mike/
> 
> ----- A day without chillies is a day wasted ------

Re: Access to jspwiki.properties in templates?

Posted by Mike Morris <mi...@gmail.com>.
2009/2/26 Murray Altheim <mu...@altheim.com>:
>
> In WikiEngine:
>
>     public Properties getWikiProperties()

Darn, I was hoping to avoid scripty stuff :-P was hoping there'd be a
suitable tag or something. Thanks much for the clue, though: its still
less of a hack than what I have at present! :-D

-- 
This email is [X]bloggable [ ]ask-first [ ]private

Mike Morris
http://mikro2nd.net/
EarthStuff: http://mikro2nd.net/blog/planb/
TechStuff: http://mikro2nd.net/blog/mike/

----- A day without chillies is a day wasted ------

Re: Access to jspwiki.properties in templates?

Posted by Murray Altheim <mu...@altheim.com>.
Mike Morris wrote:
> I've been working on a template-set that I'm using for a multiple wiki
> situation. It's a very light mod of the standard templates, such that
> the View template looks something like an ordinary (non-editable)
> website, except for authenticated users.
> 
> One thing that I want/need is to have different favicons, banner
> pictures, etc. for the different sites. So far I've hacked a
> workaround based on using the jspwiki.applicationname (which differs
> for each wiki) but its an ugly, fragile and brittle hack. Ideally I
> would like to add some properties of my own invention to the various
> jspwiki.properties files, and then pick them up in the templates. Is
> there any way to do this that I may (likely) have missed? Some of the
> documentation wiki seems to imply that this is possible, but the
> details elude me.

In WikiEngine:

      public Properties getWikiProperties()

...........................................................................
Murray Altheim <murray09 at altheim dot com>                       ===  = =
http://www.altheim.com/murray/                                     = =  ===
SGML Grease Monkey, Banjo Player, Wantanabe Zen Monk               = =  = =

       Boundless wind and moon - the eye within eyes,
       Inexhaustible heaven and earth - the light beyond light,
       The willow dark, the flower bright - ten thousand houses,
       Knock at any door - there's one who will respond.
                                       -- The Blue Cliff Record