[Seaside] Background pattern
Julian Fitzell
julian at beta4.com
Wed Nov 19 18:41:07 CET 2003
Torsten.Bergmann at phaidros.com wrote:
> Hi,
>
> I want to provide a background pattern for my
> component.
> If the image is an external resource I could
> use the background-image in the stylesheet/style method -
> but it should be provided by Squeak.
>
> The <body> is already created as part of the framework,
> so how can I provide an own one? It's created inside the
> response object - so there is no renderBodyOn: method
> in WAComponent I could overwrite.
>
> My current solution looks like this:
>
> 1. I've added a method providing a ColorForm.
> 2. implemented
> renderContentOn: html
> html document body
> attributeAt: 'background'
> put: (html urlForDocument: self resourceProvider
> stripePattern1x4x4)
>
> Is there a better way?
Hm, well if you want to add an attribute to the body, that's definitely
the way to do it. I started out writing an example of how you could do
it with the #style method but then realized you can't because it doesn't
have access to a renderer to get a url from.
You could of course create your own stylesheet during the render phase,
get a url for it, and then add it to the head. I don't think the code
would be any simpler but you would be using CSS, if that's your
preference. Try looking for senders of #style, and then see if you can
do something similar during your render phase.
Julian
--
julian at beta4.com
Beta4 Productions (http://www.beta4.com)
More information about the Seaside
mailing list