LongHairedDavid
LongHairedDavid

Reputation: 119

Making a hyperlink in Seaside with an image as the clickable item

I am building a website using Instantiation VisualAge Smalltalk Seaside. I know about the following.

renderContentOn: html
  html anchor
    url: 'http://www.seaside.st';
    with: 'Visit the Seaside'.

However, I want to make a link where an image is the clickable item and some descriptive text below. What I am doing at the moment is building this in html and having Seaside render the code. I would like to use Seaside to build the item in the same way as above but cannot find any hints. The code I use is like this:

html html: '<a
href="http://www.mywebsite.com:8080/Show some details?', imagePath, '"><img
style="border: 0px solid ;  
  text-align: right;height: 130px;" alt=""
src=" http://www.mywebsite.com:8080/images/',  imagePath, '"></a>
<br> some text'

Is there a better (and more Smalltalk) way?


'Show some details' is my sloppy typing. It is, of course, a valid class name.

However, I have tried this but following 'html text: 'Some text'.' which should just display the text , it also presents the current page class - So, if my class was DPAClassName so url: 'http://www.mywebsite.com:8080/Show some details?, imagePath'; becomes

url: 'http://www.mywebsite.com:8080/DPAClassName?, imagePath';

the display shows the text 'Some Text but as follows: 'Some Text'DPAClassName

Upvotes: 3

Views: 98

Answers (1)

Esteban A. Maringolo
Esteban A. Maringolo

Reputation: 1218

The key is in the with: message send to any tag (anchor, image, paragraph, etc.), you can pass any renderable object to it. In your first example you passed a String, but you can also pass a BlockClosure or any other object that understands renderOn:.

So, summarizing, the equivalent to what you want would be:

    html anchor
      url: 'http://www.mywebsite.com:8080/Show some details?, imagePath';
      with: [
         html image
           style: 'border: 0; height: 130px;'
           url: 'http://www.mywebsite.com:8080/images/',  imagePath ].
    html break.
    html text: 'Some text'.

As a side note, I think the Show some details part of the URI is questionable, as well as passing the imagePath without naming the parameter. But that is certainly something outside of the scope of your question.

Upvotes: 7

Related Questions