You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@roller.apache.org by "Emmanouil Batsis (Manos)" <ma...@abiss.gr> on 2009/01/19 21:30:40 UTC

Issues with theme resource and .vm template sharing?

1) I can't figure out a way to share velocity templates between themes. 
Sorry if this is a really dumb question but velocity is so new to me I'm 
not even sure whether this is a roller or a velocity question.

2) $url.themeResource does not work for me. Suppose a theme named 
"themeA" applied to a blog named "blogA", it loads it's CSS like:

$url.resource("styles/default.css")

which results in

/contextPath/blogA/resource/styles/default.css

i.e. the blog name is used instead of the theme name and it works. But, 
to load the same file from blogB using themeB, neither of these work:

$url.themeResource("themeA","styles/default.css")
$url.themeResource("blogA","styles/default.css")


which respectively produce

/myuni/themes/themeA/styles/default.css
/myuni/themes/blogA/styles/default.css

at first I thought the problem was the themes location was missing from 
the administration config UI, but it did not work even after I used the 
same value as with themes.dir from the roller-custom.properties file.

Is this a bug? I'm using 4.1.


-- 
Manos Batsis, Chief Technologist
          __    _
   ____ _/ /_  (_)_________ ____ ______
  / __ `/ __ \/ / ___/ ___// __ `/ ___/
/ /_/ / /_/ / (__  |__  )/ /_/ / /
\__,_/_.___/_/____/____(_)__, /_/
                         /____/
http://www.Abiss.gr
5, Daphnidos Street,
14122, Neo Iraklio,
Athens, Greece

Tel: +30 210 2851517

http://www.linkedin.com/in/manosbatsis

Re: Issues with theme resource and .vm template sharing?

Posted by Dave <sn...@gmail.com>.
On Mon, Jan 19, 2009 at 3:30 PM, Emmanouil Batsis (Manos)
<ma...@abiss.gr> wrote:
> 1) I can't figure out a way to share velocity templates between themes.
> Sorry if this is a really dumb question but velocity is so new to me I'm not
> even sure whether this is a roller or a velocity question.

That is by design. Themes are independent and encapsulated. We do not
provide any way to share templates between themes.

We do provide a way for you to add Velocity macros to Roller and you
can then use those in all themes. Just add a new file called
WEB-INF/velocity/roller-custom.vm and put your macros in there.


> 2) $url.themeResource does not work for me. Suppose a theme named "themeA"
> applied to a blog named "blogA", it loads it's CSS like:
>
> $url.resource("styles/default.css")
>
> which results in
>
> /contextPath/blogA/resource/styles/default.css

That is also by design.

Once you have chosen to customize a theme, the theme's templates are
copied into your weblog (in the database) and the theme's resources
are copied into your weblog's resources area. We do that so that, once
you (as an end-user of Roller) have customized a theme you are truly
on your own -- changes made to the original theme you copied will not
effect you (that old theme could even be deleted from the system but
you'll still be OK).

Because of that the $url.resource() method behaves differently in a
blog with a custom vs. a shared theme.

Hope that helps,
- Dave