If you know how many characters will fit in the box (which may be font
dependent?), then start there and work back to the next space and
truncate there. That way you'll always have complete words and the
number of words will vary depending on the total number of characters.

On Mon, May 31, 2010 at 1:30 PM, Les Mizzell <lesm...@bellsouth.net> wrote:
> Right - don't do this. Can only end in tears...
>
> OK, designer has come up with a fixed size box on the index page of a
> site that will hold X amount of stuff from a feature story on another
> page of the site. Like:
>
> yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda
> yadda yadda yadda yadda  ... [click for more]
>
> left(whatever...) won't work as the text can't end in the middle of a
> word. So, I've got a truncate function (thanks Matthew Walker) to take
> care of that.
>
> But, this STILL won't actually work because 45 really long words
> obviously take up more space than 45 short words. Might take 40 words
> sometimes. Maybe 50 others...
>
> I'm like - this is going to have to be monked with a little every time a
> new feature article is entered in the admin, because you can't tell
> exactly how much space it's going to take up.
>
> Designer is like - client isn't going to monk with it. It just has to
> work and fill EXACTLY the amount of space I've given you regardless.
>
> I can't figure out a way to get this to actually work. Change the layout
> to make the darned box expand height wise to accommodate!! Ain't gonna
> happen though.
>
> Anybody know of any way at all to get this to work? Some stupid way to
> count long words verses shorts words and come out with an average with
> would "sorta" be right every time

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334153
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to