[Seaside] How to Implement a Menu Component
conradwt at gmail.com
Mon Jul 30 21:07:29 UTC 2007
Hi, do you have sample code to compliment the description below?
On 7/30/07, Richard Eng <richard.eng at rogers.com> wrote:
> I'll also offer up how I do it, a slight variation on Michael's
> I start with a regular, static HTML mockup of my website (complete with
> separate, external CSS files), comprising a number of webpages. For each
> webpage, I create a class. Each class renders the HTML of the
> static webpage.
> (Actually, I start with a "template" class that renders individually--ie,
> with individual methods--the logo, the menu, the footer, the sidebar, etc.
> Each webpage class subclasses the template. This allows me to customize
> look of each webpage, eg, perhaps I don't want a menu or sidebar for a
> particular page. I'm leveraging HTML reuse here as best I can. And note
> side-effect benefit: the menu method, which renders an unordered list, can
> make #call: <webpage class> calls that replace the entire page, rather
> just the content subcomponent!)
> I also make use of "announcements" in my GSServiceCentre webpage, which,
> I alluded to above, has a customized look--no navigational menu, but
> a menu in the sidebar [implemented with announcements] that swaps out
> content subcomponents. Really quite nifty, actually.
> It seems to me that announcements are too specialized (swapping out
> subcomponents only) to be used for general page handling as I've outlined
> above. (I'm sure it can be done, but at what cost to complexity or design
> > 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
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Seaside