0

I know it's certainly a naive question but I couldn't figure out the answer by reading the scattered (and sometimes outdated docs) so I'm a bit confused. What's the conceptual meaning of all these view layer components and what's the difference between them? When should I use which?

I'd really appreciate if someone could shed a light on this. TIA,

BahmanM
  • 1,420
  • 10
  • 18
  • Not a complete answer, but: (1) A browser view is a multi-adapter of a context (content, usually) and a request object that is callable (calling it publishes to your browser) (2) if you have a Plone site around, try visiting /@@manage-viewlets on that site -- it is very visually explanatory; (3) the Plone community has some good documentation here, much of which is relevant in grok/bluebream or other zope context: http://developer.plone.org/views/index.html – sdupton May 21 '13 at 18:57

1 Answers1

2

A view is a basic component; it adapts a context and the request, so this component can apply data from the request and the context to produce.. something.

A page is a specialized view; it produces output aimed at the browser. It usually involves a template.

A viewlet and viewlet manager are closely tied together. A viewlet is a specialized view that is not meant to be used on it's own but is used in an assembly. The viewlet manager does the assembling here; you ask a viewlet manager for all the viewlets that are registered with that manager and are active. Viewlets are usually things like the login link, the personal information bar for logged-in users, etc. The login link would only be active if there is no logged in user, the personal bar only active if there is a logged in user, etc.

Basically, viewlets let you delegate the responsibility of a certain 'area' of rendered pages to components, where a manager handles one specific area and viewlets are the components that are used to render the snippets.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343