[Seaside] a sidebar which displays another component ?
Nicolas Petton
petton.nicolas at gmail.com
Thu Apr 26 19:05:14 UTC 2007
On Thu, Apr 26, 2007 at 10:11:37AM +0100, John Thornborrow wrote:
> Nicolas Petton wrote:
> > Hi,
> >
> > I'm using Seaside to make a web application, with some components :
> > - the main application,
> > - a sidebar,
> > - the 'contents' component.
> >
> > The main application displays the sidebar and the contents.
> > Can the sidebar have methods to change the contents ? I don't know how
> > to do this because they are both subcomponents of the main application.
> >
> > Thanks,
> >
> > Nicolas Petton
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Seaside mailing list
> > Seaside at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> I've got exactly the same setup for one of my sites, we have a main menu
> and a submenu. In order to cater for this, I have a registry which I use
> for storing the main content component (amongst other things) and this
> is passed to all components, then I have:
>
> renderContentOn: html
> html anchor class: 'menu'; with: [
> html text: 'Click this link']; callback: [
> self regsitry at: 'content' put: SomeClass new]
>
> My root component then uses:
>
> renderContentOn: html
> html render: self menu.
> html render: self submenu.
> html render: self content
>
> and of course the #content method:
>
> content
> ^(self registry at: 'content' ifNil: [DefaultContent new])
>
> HTH,
> John
>
> www.pinesoft.co.uk
Thank you for your answers !
I think about another solution, maybe easier.
In the main component, in the initialize method :
sidebar := (Sidebar new) rootComponent: self.
In the Sidebar class, I've got a rootComponent method :
rootComponent: aComponent
rootComponent := aComponent
So the sidebar knows its parent.
Is it ugly code ?
Nicolas Petton
--
___
.:! DEBIAN GNU/Linux !:. / _ \
| / |
The universal OS | \__/
\
-------------------------------------
Ma clé GPG est disponible ici :
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE788C34D
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.squeakfoundation.org/pipermail/seaside/attachments/20070426/7df0b533/attachment.pgp
More information about the seaside
mailing list