Jump to content
php.lv forumi

Kļūme insertSmilies funkcijā.


Recommended Posts

// Function:		 insertSmilies
// Description: insert smilies for adding into news/comments

function insertSmilies($insert_location, $break_location = FALSE)
{
global $config_http_script_dir, $config_smilies;

$smilies = explode(",", $config_smilies);
	foreach($smilies as $null => $smile)
	{
	$i++; $smile = trim($smile);

	$output .= "<a href=\"java script:insertext(':$smile:','$insert_location')\"><img style=\"border: none;\" alt=\"$smile\" src=\"$config_http_script_dir/data/emoticons/$smile.gif\" /></a>";
			if($i%$break_location == 0 and $break_location)
			{
					$output .= "<br />";
			}else{ $output .= " "; }
}
	return $output;
}

izmet šādu kļūmi man mājas lapā:

Warning: Division by zero in D:\web\noutrious\tense\news\inc\functions.inc.php on line 267

267 līnija = if($i%$break_location == 0 and $break_location)

Link to comment
Share on other sites

Pirmkārt jāsāk jau ar to, ka tas nav errors, bet gan Warning. Atšķirību tu tiem zini.

Nu un, ja gribi, lai tas warnings nemestos, tad salabo kodu tā, lai tas dara to, ko tu gribi. Nevajag rakstīt algoritmus, kuri paļaujās uz dalīšanu ar 0 :)

Link to comment
Share on other sites

×
×
  • Create New...