[Seaside] How to Implement a Menu Component

Michael Gorsuch michael.gorsuch at gmail.com
Sat Jul 21 21:47:19 UTC 2007


> My Seaside application have 3 components
> 1.) main component with two instance variables for menu and content
> and a children method (array with: menu with: content)
> 2.) menu subcomponent
> 3.) content subcomponent

Here's how I do it, but your mileage may vary:

I have an "Interface" component for each of my main sections.  My
Welcome page, which handles logins and new user creation is called
"GHWelcomeInterface".  Once you get beyond that, you are sent to the
meat of the app, the GHUserInterface.

GHUserInterface handles rendering the menu and has a content
subcomponent.  Since the menu is actually part of the GHUserInterface
instance rather than a subcomponent, it just swaps out 'main' (or
'content' in your case) with the appropriate content instance.

So, just to be clear, I don't have three components, I just have two:
one that handles the general state of things (including the menu), and
the other is the actual content.

Hope this helps,

Michael Gorsuch
http://www.michaelgorsuch.org


More information about the Seaside mailing list