[Nitro] Nitro: cannot control the current path of a controller when skins are called
Jimmy.Jazz at gmx.net
Wed Jun 27 05:47:13 EDT 2007
Jonathan Buch a écrit :
> Just to get the definitions right here, tell me if we have the same
> concept of Skins here.
> In Nitro, the word 'skin' is most often used for Elements. Elements
> are used in the templates (.htmlx) by writing <Page></Page> when your
> Element class has been called `Page`.
Yes, i call skin what is used in the templates like <Page></Page>. Or
simply what you declare in skin.rb
>> For instance, if you have an object like:
> class SomeOgModel
>> def to_href
> Not trying to nitpick here, but trying to get the definitions
> correct. `to_href` is a method, not really an object in this
> case, unless you mean the string inside, in which case 'string'
> would be the better term. (class added for my own clarification
Call it method and yes the problem affects the 'string' inside :)
> I'm really not sure if I'm following here. I'll try to paraphrase
> to myself, and you tell me if I got closer this time.
> So, you have a few Controllers in src/controllers, a few Models in
> src/models and (I think) a few Elements in src/skins.
> So... require'ing an Element can not influence the path on which the
> Controller is mounted. Since you're using a (relative) to_href on your
> Models, I'm assuming you use those hrefs somewhere in your Elements.
Exactly. And as you said Element should not influence the path on which
the controller is mounted.
> Are you saying, that inserting the relative URIs in <a href=""> inside
> the Elements are not relative, but always point to the root '/' at one
No, what is declared in an skin (Elements) file is correctly interpreted
by the interpreter. Only the relative URLs in models and templates point
to the root '/' every time i add a require Elementfile in the
controller. Otherwise everything is working as expected.
> How can not require'ing the Element (which would effectively remove
> all content from your page, since the content is rendered inside),
> make your paths be right?
Yes and of course i loose the rendering.
> If require'ing Elements can destroy the original Server.map, that is
> a major problem. But I somehow think that is not the case, since
> Controllers really have nothing to do with Elements, only templates do.
I hope i'm wrong here. I didn't want to bother you with a false noob
issue, but i didn't find an easy and acceptable solution. It is so weird.
> I really think this is just a problem with relative URLs, but please
> tell me if I'm wrong.
Yes it concerns relative URLs
>> A simple call to a skin
> For clarification purposes again: How do you 'call' a Skin? By writing
> <Page></Page> in your template?
Yes everything that render something and all classes you will write in
> If it's ok, I could have a look at the source, just bundle it up
> and send to me. Because I'm not sure I can help you like this,
> my thinking might just be too different.
You have spotted the problem :)
I will send it to you and take in mind it is just a bunch of codes to
help me to manipulate Elements and to ease the creation of page rendering.
Let me just the time to make it a bit more readable ;)
Thx for your help anyway.
ZZZzz /,`.-'`' -. ;-;;,_
|,4- ) )-,_. ,\ ( `'-'
More information about the Nitro-general