[Nitro] Nitro: cannot control the current path of a controller when skins are called

Jonathan Buch john at oxyliquit.de
Wed Jun 27 03:20:43 EDT 2007


Hi,

> Thanks for your fast reply, and sorry if i didn't make myself clear :)
>
> Actually nitro find all the files it needs but when you call a "skin"
> except for the 'src/skin', the program will stop to be consistent with
> Server.map

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`.

> For instance, if you have an object like:
>
class SomeOgModel
> def to_href
>     "category/#@oid"
> end
end

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
purposes)

> in src/models/blog.rb  and in the meantime have called (required) a skin
> in src/controllers/blog.rb or in run.rb, you will get a wrong path
> for to_href: http://yourserver:9000/category/1

> Also, if you remove every lines "require 'somepathto/skin'" in
> 'src/controllers/blog.rb' and in run.rb (ex: require 'src/skins/blog" )
>
> the "default" path for the controller will then be restored to the right
> value:
>
> http://yourserver:9000/blog/category/1
>
> A simple call to a skin will modify the "home"
> directory of the controller and default it to '/' despite what is
> declared in Server.map.

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.
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
point?

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?

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 really think this is just a problem with relative URLs, but please
tell me if I'm wrong.

> A simple call to a skin

For clarification purposes again:  How do you 'call' a Skin?  By writing
<Page></Page> in your template?

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.

Jo

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


More information about the Nitro-general mailing list