‘Read the full entry’ issues
July 26, 2004 /
Filed under: SQL
I’ve been asking around, and I have yet to receive an answer. I need to know how some blogs allow for only a brief "snippet" of their entry to be shown on the front page, much like I do. The reason I want to know how other people do it, is because the way I do is faulty. There are some big problems with it, and I need to get it corrected fast. I don’t have time to insert a new entry – only to see that it’s messed up the entire "blog" section. What am I talking about, you wonder...? I’m talking about the SQL query that pulls out only a certain number of characters from my entries, and displays that on screen, like you see in my blog section. This is accomplished by using a query similar to this:
Now, I know there has to be an easier way. The WHITE text in the query above basically says to pull out the first 300 characters in my entry, but use a space as the "break point," and not in between a word. In other words, it won’t cut you off in the middle of a word – but it will cut you off in the middle of a sentence, which is fine. The problem is the HTML that’s included in the entry. For example, sometimes this query spits out something like this for the browser to render:
Notice there’s no closing This has happened many times so far, on this site, and I’ve had to adjust that 300 number, to make it larger, or smaller, until all of a particular HTML tags would be showing. It’s happened with I think, perhaps, I just need to understand MySQL better, when it comes to inserting data into a TEXT field type. Unless someone knows a quick way to resolve this... Comments/Mentions |
Recent Comments
Recent Music Listens
|
Is this of any use: http://labs.silverorange.com/archives/2004/june/smarttext
Of course, most of us just use blogging software like MT or WP, saves us from these kinds of headahces. I admire you for doing it yourself though.