PHP array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Anime
    Senior Member
    • Oct 2004
    • 1841
    • 3.7.x

    PHP array

    i have a php code (posted below) i need a little help fixing

    first you need to know that everything used to be at www.animerealmz.net now the galleries are at www.galleries.animerealmz.net

    PHP Code:
    <style>
    .gallery_header {   
    text-align:center;   
    padding:25px;   
    padding-bottom:0px;
    }
    .a_container {   
    width:210px;   
    font-size:20px;   
    font-weight:bold;   
    text-align:left;   
    padding-bottom:30px; /* Adjust this value to add spacing. */
    }
    .center_td {   
    width:50%; /* Adjust this value for width of display. */
    }
    .h3_style {    
    color:silver;    
    font-family:arial;
    }
    </style>
    <?php
    $array 
    = array(
                   array(
    "Card Captior Sakura","CCS_gallery.php"),
                   array(
    "Record Of Lodoss Wars","LODOSS_gallery.php"),
                   array(
    "Gundam Wing","GW_gallery.php"),
                   array(
    "Sailor Moon","SM_gallery.php"),
                   array(
    "Tenchi","TEN_gallery.php"),
                   array(
    "Evangelion","EVA_gallery.php"),
                   array(
    "Dragon Ball Series","DB_gallery.php"),
                   array(
    "Series Experament Lain","LAIN_gallery.php"),
                   array(
    "CowBoy Bebop","CB_gallery.php"),
                   array(
    "Trigun","TRI_gallery.php"),
                   array(
    "EscaFlowne","EF_gallery.php"),
                   array(
    "Yu Gi Oh","YUGI_gallery.php"),
                   array(
    "Macross","MAC_gallery.php"),
                   array(
    "Appleseed","AS_gallery.php"),
                   array(
    "Bleach","BLEACH_gallery.php"),
                   array(
    "Blue Seed","BSeed_gallery.php"),
                   array(
    "Death Note","DeathNote_gallery.php"),
                   array(
    "Naruto","NARUTO_gallery.php"),
                   array(
    "OnePiece","OnePiece_gallery.php"),
                   array(
    "Yu Yu Hakusho","YYH_gallery.php"),
                   array(
    "Robotech","ROBO_gallery.php"),
                   array(
    "Neon Genesis Evangelion ","EVA_gallery.php"),
                   array(
    "Transformers","TF_gallery.php"),
                   array(
    "Voltron","VOL_gallery.php"),
                   array(
    "Full Metal Alchemist","FMA_gallery.php"),
                   array(
    "Porco Rosso","PorcoRosso_gallery.php"),
                   array(
    "Laputa Castle in the Sky","Laputa_gallery.php"),
                   array(
    "Love Hina","LoveHina_gallery.php"),
                   array(
    "Blood Plus","BloodPlus_gallery.php"),
                   array(
    "Trinity Blood","TrinityBlood_gallery.php"),
                   array(
    "Wolfs Rain","WolfsRain_gallery.php"),
                   array(
    "Grave of the  Fireflies","GraveoftheFireflies_gallery.php"),
                   array(
    "Ranma 1/2","Ranma_gallery.php"),
                   array(
    "Arc the Lad","ArcTheLad_gallery.php"),
                   array(
    "Ranma 1/2","Ranma_gallery.php"),
                   array(
    "Code Geass","CodeGeass_gallery.php"),
                   array(
    "Eureka Seven","EurkaSeven_gallery.php"),
                   array(
    "Ghost in the Shell","GITS_gallery.php"),
                   array(
    "Princess Mononoke","PrincessMononoke_gallery.php"),
                   array(
    "Nausica","Nausica_gallery.php"),
                   array(
    "s-CRY-ed","sCryEd_gallery.php"),
                   array(
    "Spirited Away","SpiritedAway_gallery.php"),
                   array(
    "Witch Hunter Robin","WitchHunterRobin_gallery.php"),
                   );
                  
                  
                  
                  
                  
                   
                  
    sort($array);
    $rows ceil(count($array)/3);
    echo 
    '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="3" class="gallery_header"><br /><HR color=silver><h3 class="h3_style">ARZ Home</h3><a href="http://www.animerealmz.net">Home</a><HR color=silver><h3 class="h3_style">My Gallery Pages</h3></td></tr>';
    for(
    $i=0;$i<$rows;$i++)

    echo 
    '<tr><td align="right"><div class="a_container"><a href="http://www.animerealmz.net/'.$array[$i][1].'">'.$array[$i][0].'</a></div></td>';
    echo 
    $td2 $array[$i+$rows] ? '<td align="center" class="center_td"><div class="a_container"><a href="http://www.animerealmz.net/'.$array[$i+$rows][1].'">'.$array[$i+$rows][0].'</a></div></td>' '<td align="center" class="center_td"><div class="a_container">&nbsp;</div></td>';
    echo 
    $td3 $array[$i+($rows*2)] ? '<td align="left"><div class="a_container"><a href="http://www.animerealmz.net/'.$array[$i+($rows*2)][1].'">'.$array[$i+($rows*2)][0].'</a></div></td>' '<td><div class="a_container">&nbsp;</div></td>';
    echo 
    '</tr>';
     }
    echo 
    '</table>';
    ?>

    now am i correct in thinking i have to edit just the bottome part

    PHP Code:
     
    sort
    ($array);
    $rows ceil(count($array)/3);
    echo 
    '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="3" class="gallery_header"><br /><HR color=silver><h3 class="h3_style">ARZ Home</h3><a href="http://www.animerealmz.net">Home</a><HR color=silver><h3 class="h3_style">My Gallery Pages</h3></td></tr>';
    for(
    $i=0;$i<$rows;$i++)

    echo 
    '<tr><td align="right"><div class="a_container"><a href="http://www.animerealmz.net/'.$array[$i][1].'">'.$array[$i][0].'</a></div></td>';
    echo 
    $td2 $array[$i+$rows] ? '<td align="center" class="center_td"><div class="a_container"><a href="http://www.animerealmz.net/'.$array[$i+$rows][1].'">'.$array[$i+$rows][0].'</a></div></td>' '<td align="center" class="center_td"><div class="a_container">&nbsp;</div></td>';
    echo 
    $td3 $array[$i+($rows*2)] ? '<td align="left"><div class="a_container"><a href="http://www.animerealmz.net/'.$array[$i+($rows*2)][1].'">'.$array[$i+($rows*2)][0].'</a></div></td>' '<td><div class="a_container">&nbsp;</div></td>';
    echo 
    '</tr>';
     }
    echo 
    '</table>';
    ?> 
    or do i have to change each line

    PHP Code:
     
    array("Card Captior Sakura","CCS_gallery.php"), 
    to

    PHP Code:
    array("Card Captior Sakura",www.galleries.animerealmz.net/CCS_gallery.php), 
  • Dygear
    New Member
    • Nov 2006
    • 15
    • 4.1.x

    #2
    If a programmer bought me the code you had posted, I would of executed him on the spot.

    Just replace the bottom part with this, the array does not need to be changed.

    PHP Code:
    <?php
        sort
    ($array);
        
    $rows ceil(count($array)/3);
    ?>
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td colspan="3" class="gallery_header"><br />
                    <hr color="silver">
                    <h3 class="h3_style">ARZ Home</h3> <a href="http://www.galleries.animerealmz.net">Home</a>
                    <hr color="silver">
                    <h3 class="h3_style">My Gallery Pages</h3>
                </td>
            </tr>
    <?php    for ($i 0$i $rows$i++):    ?>
            <tr>
                <td align="right">
                    <div class="a_container">
                        <a href="http://www.galleries.animerealmz.net/<?php echo $array[$i][1]; ?>"><?php echo $array[$i][0]; ?></a>
                    </div>
                </td>
    <?php
        
    // I have no idea what on earth your programmer had in mind with this part.
        
    echo $td2 $array[$i+$rows] ? '<td align="center" class="center_td"><div class="a_container"><a href="http://www.galleries.animerealmz.net/'.$array[$i+$rows][1].'">'.$array[$i+$rows][0].'</a></div></td>' '<td align="center" class="center_td"><div class="a_container">&nbsp;</div></td>';
        echo 
    $td3 $array[$i+($rows*2)] ? '<td align="left"><div class="a_container"><a href="http://www.galleries.animerealmz.net/'.$array[$i+($rows*2)][1].'">'.$array[$i+($rows*2)][0].'</a></div></td>' '<td><div class="a_container">&nbsp;</div></td>';
    ?>
            </tr>
    <?php    endFor;    ?>
        </table>
    -- Lt. Mark 'Dygear' Tomlin (2923);

    Comment

    • Mike Anime
      Senior Member
      • Oct 2004
      • 1841
      • 3.7.x

      #3
      thanks for the help.

      i am not a php person.

      i got this code for free what i need to do is get some money in my paypal account and pay someone to write me better code.

      heck i have some stuff that uses foo and bar still.

      Comment

      • Mike Anime
        Senior Member
        • Oct 2004
        • 1841
        • 3.7.x

        #4
        how much to clean up this mess ?


        see i have two such files one for FF one for IE

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...