Customizing SMF > SMF Coding Discussion

PHP While Loop!?

<< < (2/2)

The Burglar!:
now only $breadcrumbNav aint defined... but parsed good ;)

line 16 gives the error not used before defined anyway


--- Code: ---$breadcrumbNav = $linkArray[$level][1].$breadcrumbNav;

--- End code ---

ziycon:
Sorry I'm having a forgetful day, it was one of the lines I removed, here is the proper code.


--- Code: ---$breadcrumbNav = '';
$linkParent = array();
$currentPage =  $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];

$linkArray = self::getNavArray(); // returns an array of all available links on the site in the format (id, link_text, link, sequence, pages_to_display_on, parent)

for($i=0;$i<sizeof($linkArray);$i++) {
if(strstr($currentPage,$linkArray[$i][2]))
$linkParent = $linkArray[$i][5];
}

$level = $linkParent;

while($level >= 0) {
$breadcrumbNav = $linkArray[$level][1].$breadcrumbNav;
$level = $linkArray[$level][5];
}
--- End code ---

It seems that its timing out on the last line of the while loop: $level = $linkArray[$level][5];

The Burglar!:
parsed ok without errors so it good ;)

no time out but check your configuratios apache/php/mysql can be horrible sometimes :P

what are you using for development ?

ziycon:
Got it working, it was my logic with the while loop and the array. Thanks for your help. :)

The Burglar!:
be welcome :P

Navigation

[0] Message Index

[*] Previous page

Go to full version