I've implemented the truncateText method to control oversized text in a product list. I've checked the results after I've implemented it and everything looked fine. Oversized text was truncated and padded with ...
After a few days I occasionally got a totally screwed up page layout, sidebars and footers completely missing etc. Naturally I've looked first into the last changes I made to the codebase. It took a while until I realized, it was due to the truncateText method, I've implemented a couple of days ago. The truncated text comes from a 4D textfield with the multistyle option enabled. I did this to give people an easy way to do minimalistic text styling (bold, italic, font size etc.) within a 4D input form. To output the styles in A4D I have to use write raw. The problem is, the content of a text field with multistyle enabled is plain text - until you implement any style. At that point 4D not only adds the style to that portion of the text, but encloses the whole text with <span> </span>. Well, and when that happens and the text is oversized as well, truncateText springs in and chops off the closing </span> and screws the whole layout. Until I'll find a clever regexp replace to chop of text without touching any tags, I try to control the length within 4D and simply output the whole text field as is. If someone has come up with a solution, I'd love to hear about. And concerning truncateText, it would be a nice enhancement, if it would take a parameter "honor_tags". ;-) Peter _______________________________________________ Active4D-dev mailing list [email protected] http://list.aparajitaworld.com/listinfo/active4d-dev Archives: http://active4d-nabble.aparajitaworld.com/
