|
|
|
|
![]() ![]() |
Jul 12 2006, 10:27 AM
Post
#1
|
|
|
Member [Level 3] ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 95 Joined: 21-May 06 From: Adelaide, Australia Member No.: 24,017 |
I am having a little trouble on my home page with my php script,. i get a double error
QUOTE 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 115 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 115 CODE // 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 This post has been edited by BuffaloHELP: Jul 12 2006, 07:54 PM |
|
|
|
Jul 12 2006, 01:43 PM
Post
#2
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 873 Joined: 30-July 04 Member No.: 246 |
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.
|
|
|
|
Jul 12 2006, 03:34 PM
Post
#3
|
|
|
Newbie [Level 2] ![]() ![]() Group: Members Posts: 33 Joined: 9-July 06 From: Belgium Member No.: 26,367 |
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.) This post has been edited by peroim: Jul 12 2006, 03:35 PM |
|
|
|
Jul 12 2006, 06:20 PM
Post
#4
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 936 Joined: 14-April 05 From: West Chester, PA Member No.: 5,636 |
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.
|
|
|
|
Aug 7 2006, 09:21 AM
Post
#5
|
|
|
Member [Level 3] ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 95 Joined: 21-May 06 From: Adelaide, Australia Member No.: 24,017 |
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.. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 11th October 2008 - 11:56 AM |