Webobjects Developer wrote on 3/29/07 5:33 PM:
If I have an HTML template and I want to use a WO component to provide
an attribute on markup, what is the best way to do that?

I've used the following type of construct, but I'm uncomfortable with
it, at best:

<tr<webobject name="ConditionalAltRow"> class="alt"</webobject>>

I use something the following:

<webobject name=fancyTr>...</webobject>

fancyTr: WOGenericContainer
{
        elementName = "tr";
        class = callAMethod;
}

In this case, you'd move your conditional test into callAMethod, and it would return a string depending on the test, e.g. "altRow" or "normalRow". You can add any attributes you want -- class, id, etc.

There is also WOGenericElement for non-container items. For example, if you don't use WOImage but want to add extra attributes to an img tag you could do something like

<webobject name=myImg/>

myImg: WOGenericElement {
        src = methodReturningImgPat;
        alt = methodReturningAltText;
}

zak.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to