Dynamic Web Development with Seaside

9.1From Anchors to Callbacks

You can generate run-of-the-mill HTML anchors by creating an anchor brush (send WAHtmlCanvas>>anchor to the canvas), then configuring the anchor to be associated with a URL using WAAnchorTag>>url: and specifying the text for the anchor using WAAnchorTag>>with:. Here is a simple component that displays an anchor that displays a link to the Seaside web site.

WAComponent subclass: #SimpleAnchor
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'SeasideBook-Anchors'
SimpleAnchor>>renderContentOn: html
html anchor
url: 'http://www.seaside.st';
with: 'Seaside Website'

Register this component as “simple-anchor” then view the component through your browser and you should see a page similar to Figure 68.

A simple anchor

Clicking on the Seaside Website anchor will bring you to the website.

Copyright © 19 March 2024 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.