imacul8 0 Report post Posted July 12, 2006 (edited) I am having a little trouble on my home page with my php script,. i get a double error Warning: str_repeat(): Second argument has to be greater than or equal to 0. in /home/imacul8/public_html/forums/modules/navigation.php on line 115Warning: str_repeat(): Second argument has to be greater than or equal to 0. in /home/imacul8/public_html/forums/modules/navigation.php on line 115 // Additional pages$customnavigationbits = '';$mod_options['portal_navigation_addpages'] = unserialize($mod_options['portal_navigation_addpages']);if (!empty($mod_options['portal_navigation_addpages'])){ foreach ($mod_options['portal_navigation_addpages'] AS $key => $navlinks) { $link = $navlinks['link']; $title = $navlinks['text'];line 115 --- >$navmark = iif($navlinks['level'] == 1, $mod_options['portal_navigation_mark1'], str_repeat(' ', ($navlinks['level'] - 1)) . $mod_options['portal_navigation_mark2']); eval('$customnavigationbits .= "' . fetch_template('adv_portal_navigationbits') . '";'); }}eval('$home["$mods[modid]"][\'content\'] = "' . fetch_template('adv_portal_navigation') . '";');?> please help Notice from BuffaloHELP: Always use QUOTE and CODE bbcodes when pasting error messages and codes. Edited July 12, 2006 by BuffaloHELP (see edit history) Share this post Link to post Share on other sites
Spectre 0 Report post Posted July 12, 2006 Well, evidently, the str_repeat function requires the second argument to be of integer value above 0. The 'iif' statement isn't natively supported in PHP (nor in many other languages) as far as I know, so I'm assuming it's user-defined within one of your scripts; but a quick bit of research indicates that it operates on the basis of 'iif(condition,true,false)' meaning that it is evaluating '$navlinks['level'] - 1' if '$navlinks['level']' is any different to 1 - such as if it is 0, meaning that '$navlinks['level'] - 1' obviously become less than 0 and therefore illegal in that context. Additionally, I would recommend simply using 'condition ? true : false' as it is natively supported by both PHP and a wider range of languages, and much more likely to be recognised and understood by more people. Share this post Link to post Share on other sites
peroim 0 Report post Posted July 12, 2006 (edited) This is what i found about str_repeat(): string str_repeat ( string input, int multiplier ) Gives multiplier repeats of input_str. multiplier has to be greater or equal to 0. If multiplier is 0, this fuction will return an empty string. (Sorry for the possibly bad English, but I had to translate this from Dutch.) Edited July 12, 2006 by peroim (see edit history) Share this post Link to post Share on other sites
fffanatics 0 Report post Posted July 12, 2006 Basically, you are getting this error because $navlinks['level'] = 0 since subtracting 1 creates a negative number. Try displaying $navlinks['level'] prior to your condition so that you know its value because this will help in debugging the error. If that isnt it, then i dont know what the problem could be. Share this post Link to post Share on other sites
imacul8 0 Report post Posted August 7, 2006 thankyou for the help, havent had a chance to check it out yet, havent been able to get online for ages :)will post if i have any troubles with it still.. Share this post Link to post Share on other sites