Jump to content


Photo
- - - - -

Вывод материалов в зависимости от типа


Best Answer Na_uM , 11 October 2015 - 17:05

$type = $this->app->jbrequest->get("type");

смотрели что выводит переменная? 

Go to the full post


  • This topic is locked This topic is locked
4 replies to this topic

#1 MOKEV

MOKEV
  • JBZoo User (rus)
  • User rate: 11.7
  • posts: 143
  • topics: 14

Posted 11 October 2015 - 14:13

Добрый день! Прошу прощения, если уже обсуждалась данная тема. Задача вот в чём: материалы распределены по категориям и типам. У материалов разные параметры. Пытаюсь сделать, чтобы материалы выводились в табличном виде в своей категории и  в соответствии с типом. Файл с шаблоном поместил сюда \media\zoo\applications\jbuniversal\templates\catalog\renderer\item_columns\catalog.php

Вот его код

<?php

defined('_JEXEC') or die('Restricted access');
 
$this->app->jbassets->tablesorter();

$type = $this->app->jbrequest->get("type"); 
 
if ($vars['count']) :
 
    switch ($type) {
 
        case "tranzistory-polevye":
        ?>
 
        <table class="jsTableSorter tablesorter">
        <thead>
        <tr> 
            <th>Название</th>
            <th>Чертеж</th>
            <th>Параметр1</th>
            <th>Параметр2</th>
            <th>Параметр3</th>
        </tr>
        </thead>
        <tbody>
        <?php
        foreach ($vars['objects'] as $object) :
            echo $object;
        endforeach;
        ?>
        </tbody>
        </table>
 
        <? break;
 
      
        case "tranzistory-bipolyarnye":
        ?>
        <table class="jsTableSorter tablesorter">
        <thead>
        <tr>
            <th>Название</th>
            <th>Чертеж</th>
            <th>Параметр4</th>
            <th>Параметр5</th>
            <th>Параметр6</th>
        </tr>
        </thead>
        <tbody>
        <?php
        foreach ($vars['objects'] as $object) :
            echo $object;
        endforeach;
        ?>
        </tbody>
        </table>
 
        <? break;

    }
 
?>
 
<script type="text/javascript">
    jQuery(function ($) {
        $('.jsTableSorter').tablesorter({});
    });
</script>
 
<?php endif;

Здесь 'tranzistory-polevye' и 'tranzistory-bipolyarnye' это тип материала.

 

В результате на странице не выводится ни таблица, ни сами материалы. Если пользоваться общим шаблоном как в документации всё прекрасно выводится.

Прошу помочь найти причину. Заранее спасибо!


  • 0

#2 laRus

laRus
  • JBZoo User (rus)
  • User rate: 60
  • posts: 1334
  • topics: 31

Posted 11 October 2015 - 15:10

Укажите свою версию, плз. 220-221 или 215?

И какой из шаблонов (если у Вас 220-221) Вы используете на сайте?


  • 0
..minimum effort for maximum effect? - Oh yeah! It's good!..

#3 MOKEV

MOKEV
  • Topic Starter
  • JBZoo User (rus)
  • User rate: 11.7
  • posts: 143
  • topics: 14

Posted 11 October 2015 - 15:39

Версия 2.2.1, а шаблон стандартный - Default(Catalog)


  • 0

#4 Na_uM

Na_uM
  • JBZoo User (rus)
  • User rate: 16.1
  • posts: 782
  • topics: 61

Posted 11 October 2015 - 17:05   Best Answer

$type = $this->app->jbrequest->get("type");

смотрели что выводит переменная? 


  • 0

#5 MOKEV

MOKEV
  • Topic Starter
  • JBZoo User (rus)
  • User rate: 11.7
  • posts: 143
  • topics: 14

Posted 11 October 2015 - 18:07

смотрели что выводит переменная? 

спасибо за помощь, разобрался что куда...просто надо было в настройке категории указать нужный шаблон


  • 0




Click to return to top of page in style!