Re: Adding attributes to markup
Re: Adding attributes to markup
- Subject: Re: Adding attributes to markup
- From: Zak Burke <email@hidden>
- Date: Fri, 30 Mar 2007 08:37:09 -0400
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden