[Seaside] Newbie: How to add different IAComponent's?

Lukas Renggli renggli@hotmail.com
Sat, 25 May 2002 23:30:52 +0200


Hi

I'm quite new to SeaSide and I think it's great. But for hours, I've been
trying to create a small web-application, that is able to show different
pages, selectable by the user:
  ___________    __________    _______
 / *Options* \__/ Navigate \__/ About \_____________
 |                                               |
 | content of the page 'options'                 |
 |                                               |

I created a subclass of IAComponent called PageControl:

      IAComponent subclass: #PageControl
            instanceVariableNames: 'pages currentPage '
            classVariableNames: ''
            poolDictionaries: ''
            category: 'PageApp-Seaside'

      initialize
            pages := OrderedCollection new.
            currentPage := nil

Because I like to use the PageControl-Component in different places, I like
to add the sub-pages at run-time:

      addPage: aPage
            currentPage
                  ifNil: [currentPage := aPage].
            pages add: aPage

I think up to here everything should work fine, but now my problems start:
To render the header and the content I wrote some simple messages that are
called from the html-message:

      html
            ^ self header, self content

      header
            | output index |
            output := String new.
            index := 1.
            pages
                  do: [:page |
                        output := output , '<a href="@goTo: ' , index
asString , '">'.
                        output := output , page title , '</a></td>'.
                        index _ index + 1].
            ^ output , '<br>'

      content
            ^ currentPage html

As you probably see immediately, that code doesn't work at all. But I don't
know why and how to fix it.

I've read the two tutorials, had a look at the seaside-archive and the
examples shipped with SeaSide, but all sources couldn't solve my problems.

I think that I have to add some bindings, but I don't understand the
documentation (my english isn't that well) and I have no idea what is wrong
with my code.

Thanks for your help in advance,
Lukas