[Seaside] a sidebar which displays another component ?
Philippe Marschall
philippe.marschall at gmail.com
Sat Apr 28 05:24:59 UTC 2007
2007/4/26, Nicolas Petton <petton.nicolas at gmail.com>:
> 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 ?
Yes, announcements are a better solution:
http://lists.squeakfoundation.org/pipermail/seaside/2007-April/011734.html
Cheers
Philippe
> 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
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFGMPfqgxoTqOeIw00RAmpfAKDFBkKMd4hse0F1nTXP+iFY+5Nm4gCgrh+U
> d3vIXQnAzRnOqs3ViRst4RA=
> =mVNx
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
More information about the seaside
mailing list