Credit

This is another mod created by Rizu.

Problem

Your pile is massive. Like to the point that loading the page slows down your whole computer. Splitting the pile up into separate categories in eTCG sounds like too much work and/or clutter.

Solution

Let the computer sort the cards for you. Rizu’s mod allows you to split your pile up alphabetically.

Instructions

function sortmypile($tcg, $category, $start = '', $end = '', $doubles = 0) {
  $database = new Database;
  $sanitize = new Sanitize;
  $tcg = $sanitize->for_db($tcg);
  
  $tcginfo = $database->get_assoc("SELECT * FROM `tcgs` WHERE `name`='$tcg' LIMIT 1");
  $tcgid = $tcginfo['id'];
  $cardsurl = $tcginfo['cardsurl'];
  $format = $tcginfo['format'];
  
  $category = $sanitize->for_db($category);
  $cards = $database->get_assoc("SELECT `cards`, `format` FROM `cards` WHERE `tcg`='$tcgid' AND `category`='$category' LIMIT 1");
  
  $start = $sanitize->for_db($start);
  $start = strtoupper($start);
  $end = $sanitize->for_db($end);
  $end = strtoupper($end);
  $searchme = '/['.$start.'-'.$end.']/i';
  
  if($cards === '') { 
    echo '<p class="cards"><em>There are currently no cards under this category.</em></p>'; 
  } else {
    $cards = explode(',',$cards['cards']);
  
    $cards = array_map('trim', $cards);
    $card_list = array();
    foreach ($cards as $card) {
      $card = trim($card);
      array_push($card_list, $card);
    }
    $array_count = count($card_list);  
    if($doubles > 0) {
      $cardsuni = array_unique($card_list);
      $cardsdou = array_diff_assoc($card_list, array_unique($card_list));
      echo '<p class="cards">';
      foreach( $cardsuni as $card ) {
        $card = trim($card);
        if(preg_match("$searchme", $card[0])){ 
          echo '<img src="'.$cardsurl.''.$card.'.'.$format.'" alt="" title="'.$card.'" /> '; 
        } 
      }
      echo '</p><p class="cards">';
      foreach( $cardsdou as $cardd ) {
        $cardd = trim($cardd);
        if(preg_match($searchme, $cardd[0])){ 
          echo '<img src="'.$cardsurl.''.$cardd.'.'.$format.'" alt="" title="'.$cardd.'" /> '; 
        } 
      }
      echo '</p>';
    } else {
      echo '<p class="cards">';
      foreach( $card_list as $card ) {
        $card = trim($card);
        if(preg_match($searchme, $card[0])){ 
          echo '<img src="'.$cardsurl.''.$card.'.'.$format.'" alt="" title="'.$card.'" /> '; 
        } 
      }
      echo '</p>';
    } 
  } 
}
<?php sortmypile('<TCG GAME>', '<CATEGORY>', '<START>', '<END>'); ?>
<?php sortmypile('Colors', 'trade', 0, 'l'); ?>