rewrite asp code to php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Aldo

    rewrite asp code to php

    hello

    i'm trying to translate this asp code to php, but i can't get it work right.
    could anyone help me? thanks!
    a.

    ASP CODE
    ---------------------


    <%
    Public mArrContent

    'Build up the array
    Redim mArrContent(30, 5)

    mArrContent(1 , 0) = 0
    mArrContent(1 , 1) = 42
    mArrContent(1 , 2) = "folder"
    mArrContent(1 , 3) = "Leistungen "
    mArrContent(1 , 4) = 34

    mArrContent(2 , 0) = 1
    mArrContent(2 , 1) = 48
    mArrContent(2 , 2) = "page"
    mArrContent(2 , 3) = "Evaluation "
    mArrContent(2 , 4) = 42

    mArrContent(3 , 0) = 1
    mArrContent(3 , 1) = 47
    mArrContent(3 , 2) = "page"
    mArrContent(3 , 3) = "Forschung"
    mArrContent(3 , 4) = 42

    mArrContent(4 , 0) = 1
    mArrContent(4 , 1) = 49
    mArrContent(4, 2) = "page"
    mArrContent(4 , 3) = "Beratung"
    mArrContent(4 , 4) = 42

    mArrContent(5 , 0) = 0
    mArrContent(5 , 1) = 43
    mArrContent(5 , 2) = "folder"
    mArrContent(5 , 3) = "Themen"
    mArrContent(5 , 4) = 34


    mArrContent(6 , 0) = 1
    mArrContent(6 , 1) = 51
    mArrContent(6, 2) = "page"
    mArrContent(6 , 3) = "Verkehr, Umwelt & Energie"
    mArrContent(6 , 4) = 43

    mArrContent(7 , 0) = 1
    mArrContent(7 , 1) = 52
    mArrContent(7 , 2) = "page"
    mArrContent(7 , 3) = "Soziale Sicherheit & Integration"
    mArrContent(7 , 4) = 43

    mArrContent(8 , 0) = 1
    mArrContent(8 , 1) = 53
    mArrContent(8 , 2) = "page"
    mArrContent(8 , 3) = "Bildung & Familie"
    mArrContent(8 , 4) = 43

    mArrContent(9 , 0) = 1
    mArrContent(9 , 1) = 54
    mArrContent(9 , 2) = "page"
    mArrContent(9 , 3) = "Reformen"
    mArrContent(9 , 4) = 43

    mArrContent(10 , 0) = 1
    mArrContent(10 , 1) = 147
    mArrContent(10 , 2) = "page"
    mArrContent(10 , 3) = "Gesundheit "
    mArrContent(10 , 4) = 43

    mArrContent(11 , 0) = 1
    mArrContent(11 , 1) = 251
    mArrContent(11 , 2) = "page"
    mArrContent(11 , 3) = "test"
    mArrContent(11, 4) = 43

    mArrContent(12 , 0) = 0
    mArrContent(12 , 1) = 45
    mArrContent(12 , 2) = "folder"
    mArrContent(12 , 3) = "Projekte & Publikationen"
    mArrContent(12 , 4) = 34

    mArrContent(13 , 0) = 1
    mArrContent(13 , 1) = 113
    mArrContent(13 , 2) = "folder"
    mArrContent(13 , 3) = "Projekte"
    mArrContent(13 , 4) = 45


    mArrContent(14 , 0) = 2
    mArrContent(14 , 1) = 138
    mArrContent(14 , 2) = "page"
    mArrContent(14 , 3) = "Test Projekt"
    mArrContent(14 , 4) = 113


    mArrContent(15 , 0) = 2
    mArrContent(15 , 1) = 154
    mArrContent(15 , 2) = "page"
    mArrContent(15 , 3) = "Noch ein Testprojekt"
    mArrContent(15 , 4) = 113

    mArrContent(16 , 0) = 0
    mArrContent(16 , 1) = 125
    mArrContent(16, 2) = "folder"
    mArrContent(16, 3) = "Publikatio nen"
    mArrContent(16, 4) = 45


    mArrContent(17, 0) = 0
    mArrContent(17, 1) = 117
    mArrContent(17, 2) = "page"
    mArrContent(17, 3) = "Aktuelle Projekte & Publikationen"
    mArrContent(17, 4) = 45


    mArrContent(18, 0) = 0
    mArrContent(18, 1) = 118
    mArrContent(18, 2) = "page"
    mArrContent(18, 3) = "Verkehr, Umwelt & Energie"
    mArrContent(18, 4) = 45


    mArrContent(19, 0) = 0
    mArrContent(19, 1) = 119
    mArrContent(19, 2) = "page"
    mArrContent(19, 3) = "Soziale Sicherheit & Integration"
    mArrContent(19, 4) = 45


    mArrContent(20, 0) = 0
    mArrContent(20, 1) = 120
    mArrContent(20, 2) = "page"
    mArrContent(20, 3) = "Bildung & Familie"
    mArrContent(20, 4) = 45

    mArrContent(21, 0) = 0
    mArrContent(21, 1) = 121
    mArrContent(21, 2) = "page"
    mArrContent(21, 3) = "Reform & Internationale Entwicklung"
    mArrContent(21, 4) = 45

    mArrContent(22, 0) = 0
    mArrContent(22, 1) = 46
    mArrContent(22, 2) = "folder"
    mArrContent(22, 3) = "Portrait"
    mArrContent(22, 4) = 34

    mArrContent(23, 0) = 1
    mArrContent(23, 1) = 143
    mArrContent(23, 2) = "page"
    mArrContent(23, 3) = "Verst‰ndni s"
    mArrContent(23, 4) = 46

    mArrContent(24, 0) = 1
    mArrContent(24, 1) = 58
    mArrContent(24, 2) = "page"
    mArrContent(24, 3) = "Team"
    mArrContent(24, 4) = 46

    mArrContent(25, 0) = 1
    mArrContent(25, 1) = 144
    mArrContent(25, 2) = "page"
    mArrContent(25, 3) = "Auftraggeb er"
    mArrContent(25, 4) = 46

    mArrContent(26, 0) = 1
    mArrContent(26, 1) = 146
    mArrContent(26, 2) = "page"
    mArrContent(26, 3) = "Partner im Ausland"
    mArrContent(26, 4) = 46

    mArrContent(27, 0) = 1
    mArrContent(27, 1) = 145
    mArrContent(27, 2) = "page"
    mArrContent(27, 3) = "Stellenangebot "
    mArrContent(27, 4) = 46

    mArrContent(28, 0) = 1
    mArrContent(28, 1) = 262
    mArrContent(28, 2) = "page"
    mArrContent(28, 3) = "Test"
    mArrContent(28, 4) = 46

    mArrContent(29, 0) = 1
    mArrContent(29, 1) = 263
    mArrContent(29, 2) = "page"
    mArrContent(29, 3) = "so"
    mArrContent(29, 4) = 46

    mArrContent(30, 0) = 0
    mArrContent(30, 1) = 264
    mArrContent(30, 2) = "page"
    mArrContent(30, 3) = "Sitemap"
    mArrContent(30, 4) = 34


    'Call the function to Generate the Nested Array
    marrMain = GenerateNestedA rray(mArrConten t)

    'Call the function to Generate the HTML script
    Call GenerateHTML(ma rrMain)


    '/*************** *************** ****
    'This is the function that generate
    'the nested array based on a given
    'multidimension al array
    '/*************** *************** ****
    Function GenerateNestedA rray(ArrContent )
    Dim arrMain
    Dim arrSub
    Dim arrSubContent
    Redim arrSub(5)
    Redim arrMain(0)
    Dim lngCount
    For i = 1 to UBound(arrConte nt)
    Redim arrSubContent(0 )
    if arrContent(i,4) = 34 then
    lngCount = lngCount + 1
    Redim Preserve arrMain(lngCoun t)
    For j = 0 to 4
    arrSub(j) = ArrContent(i,j)
    next
    arrSub(5) = arrSubContent
    arrMain(lngCoun t) = arrSub
    else
    for j = 1 to Ubound(arrMain)
    For k = 0 to 4
    arrSub(k) = arrContent(i,k)
    next
    arrSub(5) = arrSubContent
    if FindParent(arrM ain(j), arrSub) = true then
    exit for
    End if
    Next
    end if
    next
    GenerateNestedA rray = arrMain
    end function

    '/*************** *************** ****
    'This is the function that
    'recursively find the parent
    'folder of a given page or folder
    'and then places the data into
    'the fifth element of the parent array
    '/*************** *************** ****
    Function FindParent(arrP arent, arrContent)
    On error resume next
    Dim arrSub(5)
    Dim arrTemp(5)
    Dim arrSubContent(0 )
    Dim arrSubArray
    Dim lngCount
    if arrParent(1) = arrContent(4) then
    For j = 0 to 4
    arrSub(j) = arrContent(j)
    next
    arrSub(5) = arrSubContent
    if Ubound(arrParen t(5)) = 0 then
    lngCount = 1
    redim ArrSubArray(1)
    arrSubArray(1) = arrSub
    else
    lngCount = Ubound(arrParen t(5)) + 1
    Redim arrSubArray(lng Count)
    for j = 1 to lngCount -1
    arrSubArray(j)= arrParent(5)(j)
    Next
    arrSubArray(lng Count) = arrContent
    end if
    arrParent(5) = arrSubArray
    FindParent = true
    Exit Function
    elseif Ubound(arrParen t(5)) > 0 then
    for i = 1 to Ubound(arrParen t(5))
    blnFindParent = FindParent(arrP arent(5)(i), arrContent)
    if blnFindParent = true then
    Exit function
    end if
    next
    end if
    FindParent = false
    End Function

    '/*************** *************** ****
    'This is the function that
    'Generates the HTML script
    'which then recursively call
    'WriteData function to separate
    'each group
    '/*************** *************** ****
    Function GenerateHTML(ar rMain)

    For i = 1 to Ubound(arrMain)
    Call WriteData(arrMa in(i))
    response.write "<br>"
    next
    End function


    Function WriteData(arrDa ta)
    on error resume next
    Dim arrSub(5)
    response.write "<ul>"
    response.write "<li>" & arrData(2) & " " & arrData(3)
    if Ubound(arrData( 5)) > 0 then
    for j=1 to Ubound(arrData( 5))
    Call WriteData(arrDa ta(5)(j))
    next
    End if
    response.write "</li>"
    response.write "</ul>"


    End function




    %>

    PHP CODE
    -----------------------

    <?

    //Build up the array


    $mArrContent[1][0]=0;
    $mArrContent[1][1]=42;
    $mArrContent[1][2]="folder";
    $mArrContent[1][3]="Leistungen ";
    $mArrContent[1][4]=34;

    $mArrContent[2][0]=1;
    $mArrContent[2][1]=48;
    $mArrContent[2][2]="page";
    $mArrContent[2][3]="Evaluation ";
    $mArrContent[2][4]=42;

    $mArrContent[3][0]=1;
    $mArrContent[3][1]=47;
    $mArrContent[3][2]="page";
    $mArrContent[3][3]="Forschung" ;
    $mArrContent[3][4]=42;

    $mArrContent[4][0]=1;
    $mArrContent[4][1]=49;
    $mArrContent[4][2]="page";
    $mArrContent[4][3]="Beratung";
    $mArrContent[4][4]=42;

    $mArrContent[5][0]=0;
    $mArrContent[5][1]=43;
    $mArrContent[5][2]="folder";
    $mArrContent[5][3]="Themen";
    $mArrContent[5][4]=34;


    $mArrContent[6][0]=1;
    $mArrContent[6][1]=51;
    $mArrContent[6][2]="page";
    $mArrContent[6][3]="Verkehr, Umwelt & Energie";
    $mArrContent[6][4]=43;

    $mArrContent[7][0]=1;
    $mArrContent[7][1]=52;
    $mArrContent[7][2]="page";
    $mArrContent[7][3]="Soziale Sicherheit & Integration";
    $mArrContent[7][4]=43;

    $mArrContent[8][0]=1;
    $mArrContent[8][1]=53;
    $mArrContent[8][2]="page";
    $mArrContent[8][3]="Bildung & Familie";
    $mArrContent[8][4]=43;

    $mArrContent[9][0]=1;
    $mArrContent[9][1]=54;
    $mArrContent[9][2]="page";
    $mArrContent[9][3]="Reformen";
    $mArrContent[9][4]=43;

    $mArrContent[10][0]=1;
    $mArrContent[10][1]=147;
    $mArrContent[10][2]="page";
    $mArrContent[10][3]="Gesundheit ";
    $mArrContent[10][4]=43;

    $mArrContent[11][0]=1;
    $mArrContent[11][1]=251;
    $mArrContent[11][2]="page";
    $mArrContent[11][3]="test";
    $mArrContent[11][4]=43;

    $mArrContent[12][0]=0;
    $mArrContent[12][1]=45;
    $mArrContent[12][2]="folder";
    $mArrContent[12][3]="Projekte & Publikationen";
    $mArrContent[12][4]=34;

    $mArrContent[13][0]=1;
    $mArrContent[13][1]=113;
    $mArrContent[13][2]="folder";
    $mArrContent[13][3]="Projekte";
    $mArrContent[13][4]=45;


    $mArrContent[14][0]=2;
    $mArrContent[14][1]=138;
    $mArrContent[14][2]="page";
    $mArrContent[14][3]="Test Projekt";
    $mArrContent[14][4]=113;


    $mArrContent[15][0]=2;
    $mArrContent[15][1]=154;
    $mArrContent[15][2]="page";
    $mArrContent[15][3]="Noch ein Testprojekt";
    $mArrContent[15][4]=113;

    $mArrContent[16][0]=0;
    $mArrContent[16][1]=125;
    $mArrContent[16][2]="folder";
    $mArrContent[16][3]="Publikationen ";
    $mArrContent[16][4]=45;


    $mArrContent[17][0]=0;
    $mArrContent[17][1]=117;
    $mArrContent[17][2]="page";
    $mArrContent[17][3]="Aktuelle Projekte & Publikationen";
    $mArrContent[17][4]=45;


    $mArrContent[18][0]=0;
    $mArrContent[18][1]=118;
    $mArrContent[18][2]="page";
    $mArrContent[18][3]="Verkehr, Umwelt & Energie";
    $mArrContent[18][4]=45;


    $mArrContent[19][0]=0;
    $mArrContent[19][1]=119;
    $mArrContent[19][2]="page";
    $mArrContent[19][3]="Soziale Sicherheit & Integration";
    $mArrContent[19][4]=45;


    $mArrContent[20][0]=0;
    $mArrContent[20][1]=120;
    $mArrContent[20][2]="page";
    $mArrContent[20][3]="Bildung & Familie";
    $mArrContent[20][4]=45;

    $mArrContent[21][0]=0;
    $mArrContent[21][1]=121;
    $mArrContent[21][2]="page";
    $mArrContent[21][3]="Reform & Internationale Entwicklung";
    $mArrContent[21][4]=45;

    $mArrContent[22][0]=0;
    $mArrContent[22][1]=46;
    $mArrContent[22][2]="folder";
    $mArrContent[22][3]="Portrait";
    $mArrContent[22][4]=34;

    $mArrContent[23][0]=1;
    $mArrContent[23][1]=143;
    $mArrContent[23][2]="page";
    $mArrContent[23][3]="Verst‰ndni s";
    $mArrContent[23][4]=46;

    $mArrContent[24][0]=1;
    $mArrContent[24][1]=58;
    $mArrContent[24][2]="page";
    $mArrContent[24][3]="Team";
    $mArrContent[24][4]=46;

    $mArrContent[25][0]=1;
    $mArrContent[25][1]=144;
    $mArrContent[25][2]="page";
    $mArrContent[25][3]="Auftraggeber" ;
    $mArrContent[25][4]=46;

    $mArrContent[26][0]=1;
    $mArrContent[26][1]=146;
    $mArrContent[26][2]="page";
    $mArrContent[26][3]="Partner im Ausland";
    $mArrContent[26][4]=46;

    $mArrContent[27][0]=1;
    $mArrContent[27][1]=145;
    $mArrContent[27][2]="page";
    $mArrContent[27][3]="Stellenangebo t";
    $mArrContent[27][4]=46;

    $mArrContent[28][0]=1;
    $mArrContent[28][1]=262;
    $mArrContent[28][2]="page";
    $mArrContent[28][3]="Test";
    $mArrContent[28][4]=46;

    $mArrContent[29][0]=1;
    $mArrContent[29][1]=263;
    $mArrContent[29][2]="page";
    $mArrContent[29][3]="so";
    $mArrContent[29][4]=46;

    $mArrContent[30][0]=0;
    $mArrContent[30][1]=264;
    $mArrContent[30][2]="page";
    $mArrContent[30][3]="Sitemap";
    $mArrContent[30][4]=34;


    //Call the function to Generate the Nested Array

    $marrMain=Gener ateNestedArray( $mArrContent);

    //Call the function to Generate the HTML script

    print GenerateHTML($m arrMain);





    ///*************** *************** ****
    // This is the function that generate
    // the nested array based on a given
    // multidimensiona l array
    ///*************** *************** ****

    function GenerateNestedA rray($arrConten t) {

    $arrMain = array();
    $arrSub = array();
    $arrSubContent = array();

    for ($i=1;$i<=count ($arrContent);$ i++) {

    if ($arrContent[$i][4]==34) {
    $lngCount++;
    for ($j=0;$j<=4;$j+ +) {
    $arrSub[$j] = $arrContent[$i][$j];
    }
    $arrSub[5] = $arrSubContent;
    $arrMain[$lngCount] = $arrSub;
    } else {

    for ($j=0;$j<count( $arrMain);$j++) {

    for($k=0;$k<4;$ k++){
    $arrSub[$k] = $arrContent[$i][$k];
    }
    $arrSub[5] = $arrSubContent;
    if (FindParent($ar rMain[$j],$arrSub)===fal se) {
    break;
    }
    }

    }
    }

    return $arrMain;
    }

    ///*************** *************** ****
    // This is the function that
    // recursively find the parent
    // folder of a given page or folder
    // and then places the data into
    // the fifth element of the parent array
    ///*************** *************** ****

    function FindParent($arr Parent,$arrCont ent) {

    $arrSub = array();
    $arrSubContent = array();
    $arrSubArray = array();

    if ($arrParent[1]==$arrContent[4]) {

    for ($j=0;$j<=4;$j+ +) {
    $arrSub[$j] = $arrContent[$j];
    }
    $arrSub[5] = $arrSubContent;

    if(count($arrPa rent[5])==0) {
    $lngCount = 1;
    $arrSubArray[] = $arrSub;
    } else {
    $lngCount = count($arrParen t[5])+1;
    for($j=1;$i<=$l ngCount-1;$j++) {
    $arrSubArray[$j] = $arrParent[5][$j];
    }
    $arrSubArray[$j] = $arrContent;
    }

    $arrParent[5] = $arrSubArray;
    return true;

    } else if (count($arrPare nt[5])>0) {

    for ($i=1;$i<=count ($arrParent[5]);$i++) {
    $blnFindParent = FindParent($arr Parent[5][$i],$arrContent);
    if ($blnFindParent == true) {
    break;
    }
    }
    }

    return false;

    }


    ///*************** *************** ****

    //This is the function that

    //Generates the HTML script

    //which then recursively call

    //WriteData function to separate

    //each group

    ///*************** *************** ****

    function GenerateHTML($a rrMain)
    {

    for ($i=1; $i<=count($arrM ain); $i=$i+1)
    {

    WriteData($arrM ain[$i]);
    print "<br>";

    }

    return $function_ret;
    }


    function WriteData($arrD ata)
    {
    extract($GLOBAL S);


    print "<ul>";
    print "<li>".$arr Data[2]." ".$arrData[3];
    if (count($arrData[5])>0)
    {

    for ($j=1; $j<=count($arrD ata[5]); $j=$j+1)
    {

    WriteData($arrD ata[5]($j));

    }

    }

    print "</li>";
    print "</ul>";


    }



    ?>
  • Pedro Graca

    #2
    Re: rewrite asp code to php

    Aldo wrote:[color=blue]
    > i'm trying to translate this asp code to php, but i can't get it work right.
    > could anyone help me? thanks![/color]
    [snip code]

    maybe http://www.google.com/search?q=asp%20to%20php

    --
    USENET would be a better place if everybody read:



    Comment

    • Alvaro G. Vicario

      #3
      Re: rewrite asp code to php

      *** Aldo escribió/wrote (11 Oct 2004 10:16:16 -0700):[color=blue]
      > i'm trying to translate this asp code to php, but i can't get it work right.
      > could anyone help me?[/color]

      Maybe if you could shorten the question... Nobody's going to check six
      hundred lines of code for you.


      --
      -+ Álvaro G. Vicario - Burgos, Spain
      +- http://www.demogracia.com (la web de humor barnizada para la intemperie)
      ++ Las dudas informáticas recibidas por correo irán directas a la papelera
      -+ I'm not a free help desk, please don't e-mail me your questions
      --

      Comment

      • Aldo

        #4
        Re: rewrite asp code to php

        Yes i think you're right ;-)…

        here the two functions I can't get to work in php.
        the array who is feeding the function "GenerateNested Array" has this structure:
        $mArrContent[1][0]=0; 'counter
        $mArrContent[1][1]=42; 'id
        $mArrContent[1][2]="folder"; 'folder or page
        $mArrContent[1][3]="Leistungen "; 'title
        $mArrContent[1][4]=34; 'parent id

        my goal is to build a multidimensiona l array with the right folder structure


        ASP
        -------------
        'Call the function to Generate the Nested Array
        marrMain = GenerateNestedA rray(mArrConten t)

        '/*************** *************** ****
        'This is the function that generate
        'the nested array based on a given
        'multidimension al array
        '/*************** *************** ****
        Function GenerateNestedA rray(ArrContent )
        Dim arrMain
        Dim arrSub
        Dim arrSubContent
        Redim arrSub(5)
        Redim arrMain(0)
        Dim lngCount
        For i = 1 to UBound(arrConte nt)
        Redim arrSubContent(0 )
        if arrContent(i,4) = 34 then
        lngCount = lngCount + 1
        Redim Preserve arrMain(lngCoun t)
        For j = 0 to 4
        arrSub(j) = ArrContent(i,j)
        next
        arrSub(5) = arrSubContent
        arrMain(lngCoun t) = arrSub
        else
        for j = 1 to Ubound(arrMain)
        For k = 0 to 4
        arrSub(k) = arrContent(i,k)
        next
        arrSub(5) = arrSubContent
        if FindParent(arrM ain(j), arrSub) = true then
        exit for
        End if
        Next
        end if
        next
        GenerateNestedA rray = arrMain
        end function

        '/*************** *************** ****
        'This is the function that
        'recursively find the parent
        'folder of a given page or folder
        'and then places the data into
        'the fifth element of the parent array
        '/*************** *************** ****
        Function FindParent(arrP arent, arrContent)
        On error resume next
        Dim arrSub(5)
        Dim arrTemp(5)
        Dim arrSubContent(0 )
        Dim arrSubArray
        Dim lngCount
        if arrParent(1) = arrContent(4) then
        For j = 0 to 4
        arrSub(j) = arrContent(j)
        next
        arrSub(5) = arrSubContent
        if Ubound(arrParen t(5)) = 0 then
        lngCount = 1
        redim ArrSubArray(1)
        arrSubArray(1) = arrSub
        else
        lngCount = Ubound(arrParen t(5)) + 1
        Redim arrSubArray(lng Count)
        for j = 1 to lngCount -1
        arrSubArray(j)= arrParent(5)(j)
        Next
        arrSubArray(lng Count) = arrContent
        end if
        arrParent(5) = arrSubArray
        FindParent = true
        Exit Function
        elseif Ubound(arrParen t(5)) > 0 then
        for i = 1 to Ubound(arrParen t(5))
        blnFindParent = FindParent(arrP arent(5)(i), arrContent)
        if blnFindParent = true then
        Exit function
        end if
        next
        end if
        FindParent = false
        End Function

        PHP
        --------------------

        //Call the function to Generate the Nested Array
        $marrMain=Gener ateNestedArray( $mArrContent);

        //Call the function to Generate the HTML script
        GenerateHTML($m arrMain);





        ///*************** *************** ****
        // This is the function that generate
        // the nested array based on a given
        // multidimensiona l array
        ///*************** *************** ****


        function GenerateNestedA rray($arrConten t) {

        $arrMain = array();
        $arrSub = array();
        $arrSubContent = array();

        for ($i=1;$i<=count ($arrContent);$ i++) {

        if ($arrContent[$i][4]==34) {
        $lngCount++;
        for ($j=0;$j<=4;$j+ +) {
        $arrSub[$j] = $arrContent[$i][$j];
        }
        $arrSub[5] = $arrSubContent;
        $arrMain[$lngCount] = $arrSub;

        } else {

        for ($j=1;$j<=count ($arrMain);$j++ ) {

        for($k=0;$k<4;$ k++){
        $arrSub[$k] = $arrContent[$i][$k];
        }
        $arrSub[5] = $arrSubContent;
        if (FindParent($ar rMain[$j],$arrSub)===fal se) {
        break;
        }
        }

        }
        }

        return $arrMain;
        }

        ///*************** *************** ****
        // This is the function that
        // recursively find the parent
        // folder of a given page or folder
        // and then places the data into
        // the fifth element of the parent array
        ///*************** *************** ****


        function FindParent($arr Parent,$arrCont ent) {

        $arrSub = array();
        $arrSubContent = array();
        $arrSubArray = array();

        if ($arrParent[1]==$arrContent[4]) {

        for ($j=0;$j<=4;$j+ +) {
        $arrSub[$j] = $arrContent[$j];
        }
        $arrSub[5] = $arrSubContent;

        if(count($arrPa rent[5])==0) {
        $lngCount = 1;
        $arrSubArray[] = $arrSub;
        } else {
        $lngCount = count($arrParen t[5])+1;
        for($j=1;$i<=$l ngCount-1;$j++) {
        $arrSubArray[$j] = $arrParent[5][$j];
        }
        $arrSubArray[$j] = $arrContent;
        }

        $arrParent[5] = $arrSubArray;
        return true;

        } else if (count($arrPare nt[5])>0) {

        for ($i=1;$i<=count ($arrParent[5]);$i++) {
        $blnFindParent = FindParent($arr Parent[5][$i],$arrContent);
        if ($blnFindParent == true) {
        break;
        }
        }
        }

        return false;

        }

        "Alvaro G. Vicario" <kAlvaroNOSPAMT HANKS@terra.es> wrote in message news:<lgh250l3c vcz.1dj1915u8as uj.dlg@40tude.n et>...[color=blue]
        > *** Aldo escribió/wrote (11 Oct 2004 10:16:16 -0700):[color=green]
        > > i'm trying to translate this asp code to php, but i can't get it work right.
        > > could anyone help me?[/color]
        >
        > Maybe if you could shorten the question... Nobody's going to check six
        > hundred lines of code for you.[/color]

        Comment

        Working...