It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

poblem with my echo ""

Moderator: Malcolm

poblem with my echo ""

Postby dflynn on Mon Dec 29, 2008 1:43 am

I have this:
Code: Select all
  <?
function main_menu($array, $indent=0) {
    $prefix = "";
    for ($i=0; $i<$indent; $i++) {
        $prefix .= "    ";
    }
    while (list ($key, $value) = each($array)) {
        if (is_array($value)) {
            echo $prefix . $key . "<br>";
            tree_menu($value, $indent + 1);
        } else {
            echo $prefix . "<div class='tableft'></div>  <div class='tab'><a href='" . $value . "'><font color='#FFFFFF'>" . $key . "</font></a></div>   <div class='tabright'></div>";
        }
    }
}
?>


The problem is when it outputs the last echo. For each link in the list i should go:

tableft|tab|tabright

but instead it is echoing out as

tabright|tab|tableft

any ideas why this would print out backwards?

Edit: I just realized that is actually reversing the entire echo process here.
so instead of getting

{ 1 } { 2 } { 3 }
I'm getting

} 3 { } 2 { } 1 {
User avatar
dflynn
500+ Club
 
Posts: 860
Joined: Wed Oct 03, 2007 9:06 pm
Location: Guelph, Canada

Re: poblem with my echo ""

Postby dflynn on Mon Dec 29, 2008 1:59 am

Oh, I think I just realized what's going on.
It's echoing everything out in the right order but each div is floated right, so it's building from the right side out.

:P stupid lol
User avatar
dflynn
500+ Club
 
Posts: 860
Joined: Wed Oct 03, 2007 9:06 pm
Location: Guelph, Canada


Who is online

Users browsing this forum: No registered users and 2 guests