CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 limit field view - problem with PHP script in CC

Print topic Send  topic

Author Message
Tomasz
Posted: 01/05/2002, 10:57 AM

on codecharge newsgroup there was a thread about limiting field view (in december,Subject: Re: More (teaser) / partial field view)

I've changed script from 'webmaster' - now it recognize spaces and don't cut words in a middle. But - for unknown reason - function used in CC page doesn't work on some condition. I've call it "unknown" becouse function used on php page outside CC works ok.

script is (in modules/global):

function myArticleShow($article_desc,$url) {
return myArticleShowConvert($article_desc).'... ' .
'[<a href="'.$url.'"> more </a>]';
}

function myArticleShowConvert($str, $index=10, $char=" ") {
while (substr($str, $index, 1)!=$char) $index++;
return substr($str, 0, $index);
}

and it's called on page in Show Event :

$fldnews_text = myArticleShow($fldnews_text, "news_view.php?message_id=$fldmessage_id");


$index=10 is a number of chars.
And when I use more than... 17 chars, I receive:

Fatal error: Maximum execution time of 30 seconds exceeded in common.php on line
258

function appears to be ok, becouse on static php page outside CC I can use any numer of chars. What can be wrong?
Brent
Posted: 01/05/2002, 11:12 PM

You have a potential infinite loop in:

while (substr($str, $index, 1)!=$char) $index++;

That's why it is timing out. What happens if the last character in the $str is
not a blank? It will loop forever because the substr() will
return an empty string "" and "" <> " " so it loops forever.


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.