Now let’s have even more fun. Since Seaside uses plain Smalltalk rather than templates to build web pages, we can use Smalltalk to build the logic of our rendering method. We are only limited by our imagination and artistic taste. For example, suppose that we want to display 10 Seaside logos. We can simply use the timesRepeat: Smalltalk loop as shown in the next method. See the output in Figure 58.

ScrapBook>>renderContentOn:htmlhtmlparagraph:'Fun with Smalltalk and Seaside.'.htmlparagraph:[10timesRepeat:[htmlimageurl:'http://www.seaside.st/styles/logo-plain.png';width:50]]

Figure 58: Using Smalltalk to write a loop in our rendering method.

Since we’re writing Smalltalk, changes are easy. In the next example, we added a horizontal rule inside the loop but noticed that it didn’t look very nice (see Figure 59), so we moved it outside the loop (see Figure 60).

ScrapBook>>renderContentOn:htmlhtmlparagraph:'Fun with Smalltalk and Seaside.'.htmlparagraph:[10timesRepeat:[htmlimageurl:'http://www.seaside.st/styles/logo-plain.png';width:50.htmlhorizontalRule]]

ScrapBook>>renderContentOn:htmlhtmlparagraph:'Fun with Smalltalk and Seaside.'.htmlparagraph:[10timesRepeat:[htmlimageurl:'http://www.seaside.st/styles/logo-plain.png';width:50].htmlhorizontalRule]

Figure 59: Rendering images vertically.

Figure 60: Rendering images horizontally.

Using Seaside’s canvas and brushes eliminates many of the errors that occur when manually manipulating tags.