[Helma-user] renderSkin() and app.getSkinfilesInPath()

tobias.schaefer at orf.at tobias.schaefer at orf.at
Fri Jan 11 17:09:55 CET 2008


I am confused of the following observation.

Let's assume there is an extra "skins" directory in an 
application.

In both, the app dir and the "skins" directory, a skin file
named "Foo" is available for the Global prototype.

Only the Foo.skin in the app's dir has a subskin named "bar":


Global/Foo.skin
---------------
<% #bar %>
Hello, global Foo#bar!


skins/Global/Foo.skin
---------------------
Hello, Foo.skin in skins/Global!


Ok, now let's set the skinpath to the two directories:

 res.skinpath = [app.dir + "/skins", app.dir];

(Btw. it doesn't seem to be necessary to add app.dir because
it is always included by default, isn't it?)


Now I render my subskin:

 renderSkin("Foo#bar")
 // Result: Hello, global Foo#bar!

Nice, obviously Helma merges subskins of equally named skins
from different skin paths!


But if I try to query app.skinfilesInPath for the Foo#bar 
subskin...

 var skinfiles = app.getSkinfilesInPath(res.skinpath);
 var skin = createSkin(skinfiles.Global.Foo);
 res.write(skin.hasSubskin("bar");
 // Result: false

-- Bummer!


So what I suspect is: when rendering the skin Helma first looks 
into the "skins" dir, finds the Foo.skin which doesn't contain 
the "bar" subskin. Thus, she takes the second res.skinpath value 
and finally finds Foo#bar in the app's dir, renders it and voilà!

However, when retrieving a skin via res.getSkinfilesInPath() 
Helma obviously takes a different approach and stops looking
for further skin files after she found the Foo.skin in the
"skins" dir. Because in fact it does not contain a "bar" subskin
Helma returns false for the hasSubskin() method.


Is this by purpose and if so, could please anyone explain why?

Or is it an inconsistency between how app.skinfiles are handled
and how skins are actually rendered in Helma?

If that's the case, could it be fixed?

Ciao,
tobi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://helma.org/pipermail/helma-user/attachments/20080111/485722aa/attachment.html 


More information about the Helma-user mailing list