[PHP] Truncated Text Problem

Started by G_G, May 16, 2011, 11:27:04 am

Previous topic - Next topic

G_G

I'm trying to make my blog a bit better by having a page of posts and having it cut off after 300 characters then have a ...More thing. Anyways I've got it working for the most part until it hits a tag. Expected, PHP will only post the amount of text it should, the downside to this is that some tags won't get closed and other tags get messed up.

Does anyone know a way around this, or another way to try and do what I'm doing? Or maybe a script that will close off tags?

Blizzard

You will have to parse it manually, keep track of open tags and close them manually after you cut everything off. I don't think there's a simple solution. Either that, or you restrict the text from having tags any other than <br />.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.