You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Lang, Cliff" <cl...@proxicom.com> on 2001/10/19 21:57:29 UTC
Trim() or Truncate() functions in templates
Are there any Trim(), or Truncate() functions accessible from your
templates? Can you access custom code or java functions directly from a
template?
What I have is an array of users with each user containing a variable
text field being returned with all the rows being displayed in a table.
Like the userlist table used in Flux.
What I want to do is trim the text to say 10 chars, so my table will
format nicely, then I will take the real data and make in available via
an <img alt link>
In a macro it would be something like:
#macro (entryCell $body $width)
<td bgcolor="$ui.formFieldColor" width="$width">
<font face="$ui.sansSerifFonts">
trim($body, $width) <img src="/1x.img" href="#" alt="$body">
</font>
</td>
#end
Any ideas? Is this more a velocity question?
Thanks, Cliff
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
RE: Trim() or Truncate() functions in templates
Posted by "C Mason@ Intechtual" <cm...@intechtual.com>.
It is possible to do something like this:
$body.substring(0, 10)
providing that $body is referring to a String. Although it would probably
be better to keep that logic with the code that is building your context.
Chris Mason
-----Original Message-----
From: Lang, Cliff [mailto:clang@proxicom.com]
Sent: Friday, October 19, 2001 2:57 PM
To: turbine-user@jakarta.apache.org
Subject: Trim() or Truncate() functions in templates
Are there any Trim(), or Truncate() functions accessible from your
templates? Can you access custom code or java functions directly from a
template?
What I have is an array of users with each user containing a variable
text field being returned with all the rows being displayed in a table.
Like the userlist table used in Flux.
What I want to do is trim the text to say 10 chars, so my table will
format nicely, then I will take the real data and make in available via
an <img alt link>
In a macro it would be something like:
#macro (entryCell $body $width)
<td bgcolor="$ui.formFieldColor" width="$width">
<font face="$ui.sansSerifFonts">
trim($body, $width) <img src="/1x.img" href="#" alt="$body">
</font>
</td>
#end
Any ideas? Is this more a velocity question?
Thanks, Cliff
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
HTML scripting languages comparable to Velocity
Posted by "Gonzalo A. Diethelm" <go...@aditiva.com>.
We are planning the migration of an HTML site from a proprietary
scripting language to something more standard. Because of the
architecture of the system (CGI), Java is not an option right
now. So, having used and enjoyed Turbine and Velocity a lot, I
am looking for a scripting alternative that works pretty much
like Velocity but is not Java-based. Here is what I like about
Velocity:
* simple by design: if, loops, variables.
* works off a "context" where some other process placed a lot
of <name,value(s)> pairs.
* fast!
I have been trying to find something like Velocity, hopefully as
a stand-alone module (like a mod for Apache). I see a lot of
references to PHP and Perl, but I would really like something
much simpler. Anybody has any suggestions? Thanks,
--
Gonzalo A. Diethelm
gonzalo.diethelm@aditiva.com
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org