One Deck Per Row | v1.0 | etcgfm v1.0.1 | up 12.24.13

  1. 4 years ago

    Required Mods
    None

    Purpose
    I do not take credit for making the original mod, I just edited Dite's mod to not display the fillers and just the cards and pending card. Using this mod will display your cards in any category you'd like in one deck per row. See the preview for an example.

    Preview

    Function
    This goes into your func.php, custom function page, or any pages that you will use the function on.

    function show_fillers1( $tcg, $category, $count, $high = 0, $hide = 0, $break = 5, $puzzle = 0 ) {
    
       $database = new Database;
       $sanitize = new Sanitize;
       $tcg = $sanitize->for_db($tcg);
       $category = $sanitize->for_db($category);
       
       $tcginfo = $database->get_assoc("SELECT * FROM `tcgs` WHERE `name`='$tcg' LIMIT 1");
       $tcgid = $tcginfo['id'];
       
       $cards = $database->get_assoc("SELECT `cards` FROM `cards` WHERE `tcg`='$tcgid' AND 
    
    `category`='$category' LIMIT 1");
       
       if ( $cards['cards'] === '' ) { echo '<p><em>There are currently no cards under this 
    
    category.</em></p>'; }
       else {
          
          $cards = explode(',',$cards['cards']);
          array_walk($cards, 'trim_value');
          $cards = array_unique($cards);
          $deck = array( );
       //Get decks
          foreach ( $cards as $card ) {$deck[ ] = substr($card, 0, -2); }
          $group = array_combine($cards,$deck);
          $dec_u = array_unique($deck);
          if($dec_u[0] == $dec_u[1]){$repeat = array_shift($dec_u);}
       //Results
          $etc  = array( ); 
          foreach ( $dec_u as $check ) {
             $mine = array( );
             $got = array_keys($group, $check);
             foreach ( $got as $no ) {$mine[ ] = substr($no, -2); }
             $me = count($mine);
          if($me >= $high){
             $i = 0;
             $def = range(1,$count);
             $default = array( );
             foreach($def as $no){if($no < 10){$default[ ] = '0'.$no;} else {$default[ ] = 
    
    $no;}}
          if($hide !== 2){
             echo "<p>";
             while($i < $count){
                $number = $default[$i];
                $card =$check.$number; $card = trim($card);
                $pending = $database->num_rows("SELECT * FROM `trades` WHERE 
    
    `tcg`='$tcgid' AND `receiving` LIKE '%$card%'");
                if( in_array($number,$mine)){echo '<img 
    
    src="'.$tcginfo['cardsurl'].$card.'.'.$tcginfo['format'].'" title="'.$card.'" />';}
                elseif ( $pending > 0 ) {echo '<img 
    
    src="'.$tcginfo['cardsurl'].'pending.'.$tcginfo['format'].'" title="'.$card.'" />';}
                else {echo ''; }
                $i++;
                if ($puzzle == 1) { echo ''; }
                elseif ($puzzle == 0) { echo ' '; }
                if ( $i % $break == 0 ) { echo '<br />'; }   
                }
             echo '</p>';}
          } else { foreach($mine as $one){$check = trim($check); $etc[ ] =$check.$one; }} }
          if($hide !== 1){ foreach ( $etc as $low ) {
    echo '<img src="'.$tcginfo['cardsurl'].$low.'.'.$tcginfo['format'].'" title="'.$low.'" /> ';}}
    }   }

    Execution
    Place this wherever you want the list to go.

    <? show_fillers1('Chemistry', 'Future', '15', '0', '2', '15', '0') ?>

    Please see Dite's mod for information on what each item means. However, please keep the '2' the same ($high variable).

  2. 2 years ago

    effy

    13 Sep 2015 http://twig.slothly.org

    Something I've noticed about this is that when you have a few cards pending in a deck of a similar name, that similarly named deck shows the same cards as pending.

    For example, for Ponyo, chihirolin17 causes lin17 to also show as pending. Is there a work-around for this?

or Sign Up to reply!