[Seaside] How to Implement a Menu Component

Conrad Taylor conradwt at gmail.com
Mon Jul 30 21:07:29 UTC 2007


Hi, do you have sample code to compliment the description below?
Thanks,

-Conrad


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
> approach...
>
> 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
> corresponding
> 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
> the
> 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
> the
> side-effect benefit: the menu method, which renders an unordered list, can
> make #call: <webpage class> calls that replace the entire page, rather
> than
> just the content subcomponent!)
>
> I also make use of "announcements" in my GSServiceCentre webpage, which,
> as
> I alluded to above, has a customized look--no navigational menu, but
> rather
> 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
> content
> 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
> obfuscation?)
>
> Regards,
> Richard
>
> ------------
>
> > 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
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20070730/15fb2757/attachment.htm


More information about the Seaside mailing list