PATH:
root
/
alutechniktemplates
<?php $class = "category"; ob_start(); if (!DEFINED("FLINK_CATEGORY_ID")) DEFINE("FLINK_CATEGORY_ID", 1); $cat = $db->select("kategorie{$lang}", "*", NULL, "WHERE `id` = '" . FLINK_CATEGORY_ID . "' AND `pokaz` = 1 ORDER BY `kol` ASC, `id` ASC"); if (!isset($cat[0])) header("Location: " . HOME_ROOT); else $cat = $cat[0]; $FLINK_CATEGORY = $cat; $parents = []; while ($cat['rodzic'] != 0) { array_unshift($parents, $cat); $cat = $db->select("kategorie{$lang}", "*", NULL, "WHERE `id` = '" . $cat['rodzic'] . "' AND `pokaz` = 1 ORDER BY `kol` ASC, `id` ASC")[0]; } array_unshift($parents, $cat); DEFINE("CATEGORY", $cat['nazwa']); $flinkCategoryID = $cat['id']; include_once "begin.php"; $items = 2; if (isset($FLINK_CATEGORY['liczba_kolumn']) && $FLINK_CATEGORY['liczba_kolumn'] > 0) $items = $FLINK_CATEGORY['liczba_kolumn']; if (count($parents) < 2) $items = 3; if ($items != 3) { ?> <style type="text/css"> .main__content .category__list .product__item { width: <?php echo 100 / $items - 1; ?>%; width: calc(100% / <?php echo "{$items} - {$items}"; ?> * 16px); width: calc(100% / var(--items) - var(--items) * 16px); } </style> <?php } $html = ""; $boldAttrs = [ 2 => " desc__attr--price", 10 => " desc__attr--price" ]; $scriptGalleries = []; ?> <main class="main main--<?php echo $class; ?>"> <section class="main__container container-narrow"><?php if (count($parents) > 0) { if (count($parents) > 1) { ?><h1 class="main__heading"><?php echo $FLINK_CATEGORY['nazwa']; ?></h1><?php } echo "<p><a href=\"#\">Strona główna</a>"; foreach ($parents as $pK => $parent) { $item = $parent['nazwa']; $pLink = isset($parent['url']) && $parent['url'] != "" ? $parent['url'] : "category-{$parent['id']}-" . Utils::makeLink($parent['nazwa']); if ($pK < count($parents) - 1) $item = "<a href=\"{$pLink}\">{$item}</a>"; echo "<span class=\"space\"> / </span>{$item}"; } echo "</p>"; $dbAttrs = $db->select("atrybuty{$lang}", "*", NULL, "ORDER BY `kol` ASC, `id` ASC"); $attrs = []; foreach ($dbAttrs as $attr) { $attrs[$attr['id']] = $attr['nazwa']; } $dbAttrs = $attrs; unset($attrs); $printProds = function($prods) use (&$html, &$dbAttrs, &$boldAttrs, &$scriptGalleries) { foreach ($prods as $p) { $attrs = explode(",", $p['atrybuty']); $attrsVals = Utils::parseAttributes($p['atr']); $pGallery = Utils::dirFiles(dirname($p['galeria'])); if (($key = array_search($p['galeria'], $pGallery)) !== false) { unset($pGallery[$key]); array_unshift($pGallery, $p['galeria']); } array_push($scriptGalleries, $pGallery); $css = isset($p['galeria_css']) ? $p['galeria_css'] : ""; if (strpos($css, ";") !== false) $css = substr($css, 0, strpos($css, ";")); $css = rtrim($css, ";"); if ($css != "") $css = "; background-size: {$css}"; $html .= "<span class=\"product__item\"><div class=\"product__image\"" . (isset($p['galeria']) && $p['galeria'] != "" ? " style=\"background-image: url('{$p['galeria']}'){$css}\"" : "") . "></div><div class=\"product__desc\"><p class=\"desc__name\">{$p['nazwa']}</p>"; foreach ($attrs as $aK => $aV) { if ($dbAttrs[$aV] != "" || $attrsVals[$aK]['value'] != "") { $html .= "<p class=\"desc__attr\">" . ($dbAttrs[$aV]); $bold = ""; if (array_search($aV, array_keys($boldAttrs)) !== false) $bold = $boldAttrs[$aV]; $html .= ($dbAttrs[$aV] != "" ? ": " : "") . "<span class=\"desc__attr--value{$bold}\">" . ($attrsVals[$aK]['value']) . "</span></p>"; } else continue; } if (isset($p['opis']) && $p['opis'] != "") $html .= "<div class=\"desc__custom\">{$p['opis']}</div>"; $html .= "</div></span>"; } }; $cats = $db->select("kategorie{$lang}", "*", NULL, "WHERE `rodzic` = '" . FLINK_CATEGORY_ID . "' AND `pokaz` = 1 ORDER BY `kol` ASC, `id` ASC"); $html = "<div class=\"main__content\">"; if ($FLINK_CATEGORY['tekst_gora'] != "") $html .= "<div class=\"category__text text--top\">" . $FLINK_CATEGORY['tekst_gora'] . "</div>"; $html .= "<div class=\"category__list\" style=\"--items: {$items}\">"; if (count($parents) < 2) { foreach ($cats as $c) { $counts = $db->query("SELECT (SELECT COUNT(*) FROM `produkty{$lang}` WHERE FIND_IN_SET({$c['id']}, `kategorie`) > 0 AND `pokaz` = 1) AS `cats`, (SELECT COUNT(*) FROM `kategorie` WHERE `rodzic` = {$c['id']} AND `pokaz` = 1) AS `prods`")[0]; if ($counts['cats'] < 1 && $counts['prods'] < 1 && $c['tekst_gora'] == "" && $c['tekst_dol'] == "" && $c['url'] == "") continue; $cLink = isset($c['url']) && $c['url'] != "" ? $c['url'] : "category-{$c['id']}-" . Utils::makeLink($c['nazwa']); $css = isset($c['zdjecie_css']) ? $c['zdjecie_css'] : ""; if (strpos($css, ";") !== false) $css = substr($css, 0, strpos($css, ";")); $css = rtrim($css, ";"); if ($css != "") $css = "; background-size: {$css}"; $html .= "<a class=\"category__item\" href=\"{$cLink}\"><div class=\"item__image\"" . (isset($c['zdjecie']) && $c['zdjecie'] != "" ? " style=\"background-image: url('{$c['zdjecie']}'){$css}\"" : "") . "></div><p class=\"item__desc\">{$c['nazwa']}</p></a>"; } } $prods = $db->select("produkty{$lang}", "*", NULL, "WHERE FIND_IN_SET(" . FLINK_CATEGORY_ID . ", `kategorie`) > 0 AND `pokaz` = 1 ORDER BY `kolejnosc` ASC, `id` ASC"); $printProds($prods); $html .= "</div>"; if (count($parents) >= 2) { $nth = 1; foreach ($cats as $c) { $counts = $db->query("SELECT (SELECT COUNT(*) FROM `produkty{$lang}` WHERE FIND_IN_SET({$c['id']}, `kategorie`) > 0 AND `pokaz` = 1) AS `cats`, (SELECT COUNT(*) FROM `kategorie` WHERE `rodzic` = {$c['id']} AND `pokaz` = 1) AS `prods`")[0]; if ($counts['cats'] < 1 && $counts['prods'] < 1 && $c['tekst_gora'] == "" && $c['tekst_dol'] == "" && $c['url'] == "") continue; $prods = $db->select("produkty{$lang}", "*", NULL, "WHERE FIND_IN_SET({$c['id']}, `kategorie`) > 0 AND `pokaz` = 1 ORDER BY `kolejnosc` ASC, `id` ASC"); $cLink = isset($c['url']) && $c['url'] != "" ? $c['url'] : "category-{$c['id']}-" . Utils::makeLink($c['nazwa']); $items = 3; if (isset($c['liczba_kolumn']) && $c['liczba_kolumn'] > 0) $items = $c['liczba_kolumn']; if ($items != 2) { $h = 200 * 3 / $items; ?> <style type="text/css"> .category__list.entry-<?php echo $nth; ?> .product__image { height: <?php echo $h; ?>px; height: <?php echo $h / 16; ?>rem; } .category__list.entry-<?php echo $nth; ?> .product__item { width: <?php echo 100 / $items - 1; ?>%; width: calc(100% / <?php echo "{$items} - {$items}"; ?> * 16px); width: calc(100% / var(--items) - var(--items) * 16px); } .category__list.entry-<?php echo $nth; ?> .product__item::before { top: <?php echo $h; ?>px; top: <?php echo $h / 16; ?>rem; } </style> <?php } $html .= "<h1 class=\"category__heading\">" . ($cLink != "" ? "<a href=\"{$cLink}\">{$c['nazwa']}</a>" : $c['nazwa']) . "</h1>"; if ($c['tekst_gora'] != "") $html .= "<div class=\"category__text text--top\">" . $c['tekst_gora'] . "</div>"; $html .= "<div class=\"category__list entry-{$nth}\" style=\"--items: {$items}\">"; $printProds($prods); $html .= "</div>"; if ($c['tekst_dol'] != "") $html .= "<div class=\"category__text text--bottom\">" . $c['tekst_dol'] . "</div>"; $nth++; } // $html .= "</div>"; } if ($FLINK_CATEGORY['tekst_dol'] != "") $html .= "<div class=\"category__text text--bottom\">" . $FLINK_CATEGORY['tekst_dol'] . "</div>"; $html .= "</div>"; $htmlMenu = ""; if ($FLINK_CATEGORY['rodzic'] != 0) { $cats = $db->select("kategorie{$lang}", "*", NULL, "WHERE `rodzic` = '" . $FLINK_CATEGORY['rodzic'] . "' AND `pokaz` = 1 ORDER BY `kol` ASC, `id` ASC"); $htmlMenu = "<div class=\"main__two\"> <nav class=\"main__nav\"> <input id=\"heading__checkbox\" type=\"checkbox\"> <ul class=\"nav__list\"> <li class=\"nav__item list__heading\"><label for=\"heading__checkbox\">▼</label></li>"; foreach ($cats as $c) { $counts = $db->query("SELECT (SELECT COUNT(*) FROM `produkty{$lang}` WHERE FIND_IN_SET({$c['id']}, `kategorie`) > 0 AND `pokaz` = 1) AS `cats`, (SELECT COUNT(*) FROM `kategorie` WHERE `rodzic` = {$c['id']} AND `pokaz` = 1) AS `prods`")[0]; if ($counts['cats'] < 1 && $counts['prods'] < 1 && $c['tekst_gora'] == "" && $c['tekst_dol'] == "" && $c['url'] == "") continue; $cLink = isset($c['url']) && $c['url'] != "" ? $c['url'] : "category-{$c['id']}-" . Utils::makeLink($c['nazwa']); $htmlMenu .= "<li class=\"nav__item" . ($c['id'] == $FLINK_CATEGORY['id'] ? " active" :"") . "\"> <a" . ($c['id'] != $FLINK_CATEGORY['id'] ? " href=\"{$cLink}\"" : "") . ">{$c['nazwa']}</a> </li>"; } $htmlMenu .= "</ul> </nav> {$html} </div>"; $html = $htmlMenu; } } echo $html; ?> </section> </main> <?php if (true) { $addDep = [ "lightGallery" => [ "css" => "css/lightgallery.min.css", "js" => "js/lightgallery-all.min.js"] ]; $script = "<script type=\"text/javascript\"> var galleries = " . json_encode($scriptGalleries) . ";"; $script .= <<<JS $(document).ready(function() { $(".main__content").on("click", ".product__image", function(event) { var parent = $(event.delegateTarget).find(".product__image"); var el = $(this); var index = parent.index(el); var dynamic = []; for (i in galleries[index]) { dynamic.push({src: galleries[index][i], thumb: galleries[index][i]}); } el.lightGallery({ closable: true, dynamic: true, dynamicEl: dynamic, download: false }); }); $(".main__content .product__item").on("click", ".desc__custom a", function(event) { var src = event.target.href; if (src.search(/\.(jpe?g|jfif|gif|bmp|pnga?|webp|svg)$/gi) < 0) return true; $(this).lightGallery({ closable: true, dynamic: true, dynamicEl: [{src: src}], counter: false, download: false }); event.stopPropagation(); event.preventDefault(); }); $(".category__text.text--top img, .category__text.text--bottom img").on("click", function(event) { var src = event.target.src; if (event.target.dataset["src"]) { src = event.target.dataset["src"]; } else return true; if (src.search(/\.(jpe?g|jfif|gif|bmp|pnga?|webp|svg)$/gi) < 0) return true; try { $(this).destroy(); } catch(err) { void(null); } $(this).lightGallery({ dynamic: true, dynamicEl: [{src: src}], counter: false, download: false }); event.stopPropagation(); event.preventDefault(); }); }); JS; $script .= "</script>"; echo $script; $addToFooter = "<style type=\"text/css\">.lg-backdrop.in {opacity: 0.5;}</style>"; } $content = ob_get_clean(); $content = str_replace(["{%CATEGORY%}", "{%CATEGORY|UPPERCASE%}"], [CATEGORY, mb_strtoupper(CATEGORY)], $content); echo $content; include_once "footer.php"; ?> </body> </html>
[-] page-cry.php
[edit]
[-] gallery.php
[edit]
[-] contact.php
[edit]
[-] paginator.php
[edit]
[+]
..
[-] form.php
[edit]
[-] page-multi.php
[edit]
[-] header.php
[edit]
[-] top.php
[edit]
[-] page-sales.php
[edit]
[-] form-send.php
[edit]
[-] page-testimonials.php
[edit]
[-] category.php
[edit]
[-] home.php
[edit]
[-] footer.php
[edit]
[-] page-m.php
[edit]
[-] page.php
[edit]
[-] page-video.php
[edit]
[-] news.php
[edit]
[-] page-m2.php
[edit]
[-] page-work.php
[edit]
[-] ajax_more.php
[edit]
[-] begin.php
[edit]
[-] realizations.php
[edit]
[-] page-press.php
[edit]