Quote:
|
Sometimes, as it parses youtube and images, it cuts out half way through the coding
|
I ran into the same problem myself, I'll try and explain how I fixed it. I was using a while loop to display a certain amount of blog posts, so each cycle of the loop is a blog post with title, body etc. Each time the loop passed it would add the length of the body to a variable, like
PHP Code:
$total = $total + strlen($blog_body);
This variable $total would accumulate each time a blog post was added, and as soon as it passed a certain limit (e.g. 1500) I told it to break the while loop and hence no more blog posts would be added, but none of them would be cut off mid sentence either.
So if you're using a while loop (which you most likely are), then try adding something like this:
PHP Code:
$total = 0;//Set the variable which will growth with each blog post added
$blog_counter=1;
while ($blog_counter<=5) {//show a maximum of 5 blog posts no matter what
if ($total > 1500) {
break;//Stop display blog posts if maximum string length is exceeded, 1500 in this case
}
//code for display blog content using $blog_counter to identify which blog post goes here
$total = $total + strlen($blog_body);//increment the string length to the $total variable
$blog_counter++;
}