Here's a mod you can use to combine different categories into one pile.
// Combine up to 5 categories into one pile. // $tcg = the name of the TCG as defined in the database. // $cata, $catb, $catc, $catd, $cate = the categories you want to combine. a and b are obligatory. // $doubles = 1 divide pile into uniques/doubles; 2 shows only unique cards; 3 shows only doubles. function combinemypile($tcg, $doubles = 0, $cata, $catb, $catc = '', $catd = '', $cate = '') { $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']; $cata = $sanitize->for_db($cata); $catb = $sanitize->for_db($catb); $catc = $sanitize->for_db($catc); $catd = $sanitize->for_db($catd); $cate = $sanitize->for_db($cate); $cardsa = $database->get_assoc("SELECT `cards`, `format` FROM `cards` WHERE `tcg`='$tcgid' AND `category`='$cata' LIMIT 1"); $cardsb = $database->get_assoc("SELECT `cards`, `format` FROM `cards` WHERE `tcg`='$tcgid' AND `category`='$catb' LIMIT 1"); if($catc === '') { $cardsc = ''; } else { $cardsc = $database->get_assoc("SELECT `cards`, `format` FROM `cards` WHERE `tcg`='$tcgid' AND `category`='$catc' LIMIT 1"); $cardsc = $cardsc['cards']; } if($catd === '') { $cardsd = ''; } else { $cardsd = $database->get_assoc("SELECT `cards`, `format` FROM `cards` WHERE `tcg`='$tcgid' AND `category`='$catd' LIMIT 1"); $cardsd = $cardsd['cards']; } if($cate === '') { $cardse = ''; } else { $cardse = $database->get_assoc("SELECT `cards`, `format` FROM `cards` WHERE `tcg`='$tcgid' AND `category`='$cate' LIMIT 1"); $cardse = $cardse['cards']; } $cards = $cardsa['cards'] . ', ' . $cardsb['cards'] . ', ' . $cardsc . ', ' . $cardsd . ', ' . $cardse; if ( $cards === ', , , ,' ) { echo '<p class="cards"><em>There are currently no cards under this category.</em></p>'; } else { $cardsall = explode(', ',$cards); sort($cardsall); $cardsall = array_map(trim, $cardsall); $cardsuni = array_unique($cardsall); $cardsdou = array_diff_assoc($cardsall, array_unique($cardsall)); if($doubles == 0) { echo '<p class="cards">'; foreach ( $cardsall as $card ) { $card = trim($card); if($card != '') { echo '<img src="'.$cardsurl.''.$card.'.'.$format.'" alt="" title="'.$card.'" /> '; } } echo '</p>'; } else { if($doubles == 1 || $doubles == 2 ) { echo '<p class="cards">'; foreach ( $cardsuni as $card ) { $card = trim($card); if($card != '') { echo '<img src="'.$cardsurl.''.$card.'.'.$format.'" alt="" title="'.$card.'" /> '; } } echo '</p>'; } if($doubles == 1 || $doubles == 3 ) { echo '<p class="cards">'; foreach ( $cardsdou as $cardd ) { $cardd = trim($cardd); if($cardd != '') { echo '<img src="'.$cardsurl.''.$cardd.'.'.$format.'" alt="" title="'.$cardd.'" /> '; } } echo '</p>'; } } } }
combinemypile($tcg, $doubles, $cata, $catb, $catc, $catd, $cate);
combinemypile('TCG name', '', '#-M', 'N-Z');"I want them to be divided into uniques and doubles".
combinemypile('TCG name', '1', '#-M', 'N-Z');"I changed my mind and now I want to show the uniques in one page and the doubles in another one".
combinemypile('TCG name', '2', '#-M', 'N-Z'); echo '<hr />'; /// just to separate the piles combinemypile('TCG name', '3', '#-M', 'N-Z');"Oh. I just created a new category for my newest cards (New) and I also want to combine it".
combinemypile('TCG name', '', '#-M', 'N-Z', 'New');That's all. If you need help or find some mistake, please let me know :D