Re: Silva 2.2 Layot: How to

"Luthiger Stoll Benno" <[email protected]> Wed, 2 Jun 2010 10:31:48 +0200
Newsgroups gmane.comp.web.zope.silva.devel
Message-ID <[email protected]>
Dear Silvain

Yes, the distinction between view, provider, layout is new in Silva and I
have to accustom for these concepts.

Anyway 'provider/static/...' does the trick in my case.

Thanks,
Benno


-----Original Message-----
From: Sylvain Viollon [mailto:[email protected]] 
Sent: Mittwoch, 2. Juni 2010 10:25
To: Luthiger Stoll Benno
Cc: silva-dev-IAPFreCvJWM6s/[email protected]
Subject: Re: [silva-dev] Silva 2.2 Layot: How to

On Wed, 2 Jun 2010 09:57:22 +0200
"Luthiger Stoll  Benno" <[email protected]> wrote:

> Dear Sylvain
> 

  Hello,

> Thanks for your reply.
> 
> The solution you propose doesn't work for me.
> When I enter the following statement in my page template:
> ===
> <p tal:content="layout/static/absolute_url">test</p>
> ===
> I get the following displayed:
> http://localhost:8087/silva/my_sites/++resource++silva.core.layout.porto 
> 
> That's not what I expect. I'd rather expect something pointing to
> my_layout: http://localhost:8087/silva/my_sites/++resource++my_layout
> 
> Any hints?

  I guess it is because you are not working in the layout component
  itself, but in an included content provider. In case of a content
  provider you can do:

  provider/static/...

  Instead of layout/static/...

  In case of a view:

  view/static/ ...

  You have view, provider, layout defined which refer to the Python
  classes associated with the templates. The 'static' attribute
  available on them refer to the static directory located in the same
  directory than your Python file containing the code for the view,
  provider, layout is.

  The view, provider, layout might be confusing at first but are
  powerful:

  - a layout is like a frame for your page of items that never changes.

  - a content provider is a square of the page that you want to change
    depending of the rendered content. For instance you could image a
    portlet-like thingy that display some information with a rendered
    document, and something completely different with a folder. For
    instance it is used here as a block for the navigation and content:
    http://www.wu.ac.at/prospective/, and an another one of the same
    name is defined for the interface IRoot (via grok.context) to get
    no navigation and a column of portlet instead on the other side:
    http://www.wu.ac.at/ (the layout in wu.ac.at is created with
    silva.core.layout).

  - a view is used to render for instance a document, or a folder. It
    is the equivalent of scripts located in view/public of the old
    Silva Views mechanics. Usually you don't customize those in skins,
    but if you wish you can still do it (by defining a new view for
    this content like done in the base code, and specifying
    grok.layer(IYourSkinLayer) in your customized view. Your
    customized view can for instance inherit the default one and just
    provide a new template, that's a good way of doing it).

  In the Python classes associated with your components (layout,
  provider, views) you can add some code to compute things if you need
  (instead of using python: expression in your template). That usually
  makes things easier to read afterward.

  An another tip is that you can make skins inheriting of each others:
  you just define new layers that inherit of the base skin you want to
  reuse. Like this you can include more CSS, and or change just a block
  of your layout by inheriting it and customizing it (like for a view).

  I hope this will help you a bit,

  Regards,

  Sylvain,


-- 
Sylvain Viollon -- Infrae
t +31 10 243 7051 -- http://infrae.com
Hoevestraat 10 3033GC Rotterdam -- The Netherlands

_______________________________________________
silva-dev mailing list
silva-dev-IAPFreCvJWM6s/[email protected]
https://lists.infrae.com/mailman/listinfo/silva-dev
smime.p7s (application/x-pkcs7-signature, 4.5 KB) - not displayed