Sale error con return y while:
Parse error: syntax error, unexpected T_RETURN, expecting T_WHILE
Este es el codigo:
Código PHP:
public function getnavbarlinks( $type )
{
global $db;
global $crt_lang;
$result = fetchAssocList( "select ".TABLE_CUSTOM_PAGES.".*, ".TABLE_CUSTOM_PAGES."_lang.title from ".TABLE_CUSTOM_PAGES." LEFT JOIN ".TABLE_CUSTOM_PAGES."_lang on ".TABLE_CUSTOM_PAGES.".`id` = ".TABLE_CUSTOM_PAGES."_lang.`id` where ".TABLE_CUSTOM_PAGES.".navlink='{$type}' and read_only=0 and active=1 and `lang_id`='{$crt_lang}' order by `order_no`" );
$no = count( $result );
$i = 0;
while ( $i < $no )
{
$result[$i]['moved'] = 0;
$result[$i]['parent'] = 0;
$result[$i]['str'] = "";
$result[$i]['title'] = clean( $result[$i]['title'] );
$result[$i]['url_title'] = _urlencode( $result[$i]['title'] );
$result[$i]['level'] = 1;
++$i;
}
$found = 1;
do
{
if ( $found )
{
$found = 0;
$i = 0;
do
{
} while ( !( $i < $no ) );
if ( $result[$i]['parent_id'] && !$result[$i]['moved'] )
{
$found = 1;
$element = $result[$i];
array_splice( $result, $i, 1 );
$found = 0;
$level = 1;
$j = 0;
while ( $j < $no - 1 && !$found )
{
if ( $result[$j]['id'] == $element['parent_id'] )
{
$pos_parent = $j;
$pos = $j + 1;
while ( $pos < $no - 1 && $result[$pos]['parent_id'] == $element['parent_id'] && $result[$pos]['order_no'] < $element['order_no'] )
{
++$pos;
if ( $pos < $no - 1 && $result[$pos]['parent_id'] == $result[$pos - 1]['id'] )
{
$p = $result[$pos]['parent_id'];
do
{
if ( $pos < $no - 1 && $result[$pos]['parent_id'] == $p )
{
++$pos;
}
} while ( 1 );
}
}
$ss = $result[$pos_parent]['str'];
$result[$pos_parent]['parent'] = 1;
$found = 1;
$level = $result[$pos_parent]['level'];
}
++$j;
}
array_splice( $result, $pos, 0, array( $element ) );
$result[$pos]['str'] = $ss." ";
$result[$pos]['moved'] = 1;
$result[$pos]['level'] = $level + 1;
$j = 0;
while ( $j < $no )
{
if ( $result[$j]['parent_id'] == $element['id'] )
{
$result[$j]['moved'] = 0;
}
++$j;
}
}
if ( $result[$i]['parent_id'] == 0 )
{
$result[$i]['str'] = "";
}
++$i;
} while ( 1 );
}
return $result;
}
Muchas Gracias