See the code I posted here : https://trac.cakephp.org/ticket/2242
There is also code for a similar function here : https://trac.cakephp.org/ticket/2306 and here : http://groups.google.com/group/cake-php/browse_thread/thread/fbc9a90b2fbfa95b/303980c8ef01abea?lnk=gst&q=truncate&rnum=1#303980c8ef01abea Bear in mind that both of these solutions require you to use xhtml - if you had the following (valid) HTML it would not work <p>bla bla <p>woof woof <ul> <li>one <li>two </ul> On Dec 18, 12:03 pm, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote: > Hi, > > I ran into a slight problem using TextHelper->truncate() and > excerpt(), and I don't know if it's possible to handle with Cake API. > > I have an article, which of course contains HTML code. When I try to > get a preview of an article, I do one of the above and I am of course > left with an open HTML tag..such as: > > <p>How are you, are you swell?</p> > <ul> > <li>Good</li> > <li>Not as good</li> > </ul> > > If I try to truncate to 45 letters, I will have unclosed <ul> and <li> > items.. Not what I had in mind.. > > Is there a sensible way to work around this issue? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
