Перейти к содержимому


Фотография
- - - - -

Изменение таблицы при различных видах поиска


Лучший Ответ Станислав , 10 August 2013 - 12:15

Как-то так... (catalog.php в item_columns)
 

<?php
/**
 * JBZoo is universal CCK based Joomla! CMS and YooTheme Zoo component
 * @category   JBZoo
 * @author     smet.denis <admin@joomla-book.ru>
 * @copyright  Copyright (c) 2009-2012, Joomla-book.ru
 * @license    http://joomla-book.ru/info/disclaimer
 * @link       http://joomla-book.ru/projects/jbzoo JBZoo project page
 */
defined('_JEXEC') or die('Restricted access');

$this->app->jbassets->tablesorter();

// Запоминаем тип материала
$type = $this->app->jbrequest->get("type"); 

if ($vars['count']) :

   // Переключаем шапки в зависимости от вида материала
    switch ($type) {

       // Если ipotechnaya-programma
        case "ipotechnaya-programma":
        ?>

        <table class="jsTableSorter tablesorter">
        <thead>
        <tr>
            <th>Программа</th>
            <th>Банк</th>
            <th>Срок кредитования, лет</th>
            <th>Сумма кредита, тыс. руб</th>
            <th>Ставка до ОПС max, %</th>
            <th>Ставка после ОПС max, %</th>
            <th>Первоначальный взнос от, %</th>
        </tr>
        </thead>
        <tbody>
        <?php
        foreach ($vars['objects'] as $object) :
            echo $object;
        endforeach;
        ?>
        </tbody>
        </table>

        <? break;

       // Если novostrojki-predl
        case "novostrojki-predl":
        ?>
        <table class="jsTableSorter tablesorter">
        <thead>
        <tr>
            <th>Фото</th>
            <th>Адрес</th>
            <th>Район</th>
            <th>Сдача</th>
            <th>Застройщик</th>
            <th>Материал</th>
            <th>Метро</th>
        </tr>
        </thead>
        <tbody>
        <?php
        foreach ($vars['objects'] as $object) :
            echo $object;
        endforeach;
        ?>
        </tbody>
        </table>


        <? break;

       // Если что-то еще...
        case "SOMETHING_ELSE":
        ?>

        <table class="jsTableSorter tablesorter zebra">
        <!-- Еще один блок с шапкой -->
        </table>

        <? break;

    }

?>

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

<?php endif;

Перейти к сообщению


  • Закрытая тема Тема закрыта
Сообщений в теме: 2

#1 tri

tri

Отправлено 10 August 2013 - 06:37

Денис не так давно отвечал мне на вопрос, суть такова:
 
Если шаблон назвать так же как псевдоним всего каталога (можно увидеть в настройках). То он сам будет подключаться и тогда его не обязательно указывать в категориях.

Сейчас вижу два решения
Отделить программы ипотеки в новый каталог
Либо внутри шаблона item_columns менять шапку в зависимости от искомого типа материала
например так



	<?php
	/**
	 * JBZoo is universal CCK based Joomla! CMS and YooTheme Zoo component
	 * @category   JBZoo
	 * @author     smet.denis <admin@joomla-book.ru>
	 * @copyright  Copyright (c) 2009-2012, Joomla-book.ru
	 * @license    [url=http://joomla-book.ru/info/disclaimer]http://joomla-book.ru/info/disclaimer[/url]
	 * @link       [url=http://joomla-book.ru/projects/jbzoo]http://joomla-book.ru/projects/jbzoo[/url] JBZoo project page
	 */
	defined('_JEXEC') or die('Restricted access');
	if (JRequest::getVar('type') == 'ipotechnaya-programma') {
	$this->app->jbassets->tablesorter();
	 
	if ($vars['count']) : ?>
	    <table class="jsTableSorter tablesorter">
	        <thead>
	        <tr>
	            <th>Программа</th>
	            <th>Банк</th>
	            <th>Срок кредитования, лет</th>
	            <th>Сумма кредита, тыс. руб</th>
	            <th>Ставка до ОПС max, %</th>
	            <th>Ставка после ОПС max, %</th>
	            <th>Первоначальный взнос от, %</th>
	        </tr>
	        </thead>
	        <tbody>
	            <?php
	            foreach ($vars['objects'] as $object) :
	                echo $object;
	            endforeach;
	            ?>
	        </tbody>
	    </table>
	 
	    <script type="text/javascript">
	        jQuery(function ($) {
	            $('.jsTableSorter').tablesorter({});
	        });
	    </script>
	 
	<?php endif;
	} else {
	$this->app->jbassets->tablesorter();
	 
	if ($vars['count']) : ?>
	    <table class="jsTableSorter tablesorter">
	        <thead>
	        <tr>
	            <th style="width:110px;">Фото</th>
	            <th>Адрес</th>
	            <th>Район</th>
	            <th>Сдача</th>
	            <th>Застройщик</th>
	            <th>Материал</th>
	            <th>Метро</th>
	        </tr>
	        </thead>
	        <tbody>
	            <?php
	            foreach ($vars['objects'] as $object) :
	                echo $object;
	            endforeach;
	            ?>
	        </tbody>
	    </table>
	 
	    <script type="text/javascript">
	        jQuery(function ($) {
	            $('.jsTableSorter').tablesorter({});
	        });
	    </script>
	 
	<?php endif;
	}
	 
 
Извиняюсь за флуд, вопрос не обязательно к разработчикам, может кто знающий php подскажет, как должно выглядеть, если условий несколько, я очень не силен в этом
 
 
	<?php
	/**
	 * JBZoo is universal CCK based Joomla! CMS and YooTheme Zoo component
	 * @category   JBZoo
	 * @author     smet.denis <admin@joomla-book.ru>
	 * @copyright  Copyright (c) 2009-2012, Joomla-book.ru
	 * @license    [url=http://joomla-book.ru/info/disclaimer]http://joomla-book.ru/info/disclaimer[/url]
	 * @link       [url=http://joomla-book.ru/projects/jbzoo]http://joomla-book.ru/projects/jbzoo[/url] JBZoo project page
	 */
	defined('_JEXEC') or die('Restricted access');
	if (JRequest::getVar('type') == 'ipotechnaya-programma') {
	$this->app->jbassets->tablesorter();
	 
	if ($vars['count']) : ?>
	    <table class="jsTableSorter tablesorter">
	        <thead>
	        <tr>
	            <th>Программа</th>
	            <th>Банк</th>
	            <th>Срок кредитования, лет</th>
	            <th>Сумма кредита, тыс. руб</th>
	            <th>Ставка до ОПС max, %</th>
	            <th>Ставка после ОПС max, %</th>
	            <th>Первоначальный взнос от, %</th>
	        </tr>
	        </thead>
	        <tbody>
	            <?php
	            foreach ($vars['objects'] as $object) :
	                echo $object;
	            endforeach;
	            ?>
	        </tbody>
	    </table>
	 
	    <script type="text/javascript">
	        jQuery(function ($) {
	            $('.jsTableSorter').tablesorter({});
	        });
	    </script>
	 
	<?php endif;
	
if (JRequest::getVar('type') == 'novostrojki-predl') {
$this->app->jbassets->tablesorter();
 
if ($vars['count']) : ?>
    <table class="jsTableSorter tablesorter">
        <thead>
        <tr>
            <th>Фото</th>
            <th>Адрес</th>
            <th>Район</th>
            <th>Сдача</th>
            <th>Застройщик</th>
            <th>Материал</th>
            <th>Метро</th>
        </tr>
        </thead>
        <tbody>
            <?php
            foreach ($vars['objects'] as $object) :
                echo $object;
            endforeach;
            ?>
        </tbody>
    </table>
 
    <script type="text/javascript">
        jQuery(function ($) {
            $('.jsTableSorter').tablesorter({});
        });
    </script>
 
<?php endif;
	 
	
	 
	} else {
	$this->app->jbassets->tablesorter();
	 
	if ($vars['count']) : ?>
	    <table class="jsTableSorter tablesorter">
	        <thead>
	        <tr>
	            <th style="width:110px;">Фото</th>
	            <th>Адрес</th>
	            <th>Район</th>
	            <th>Сдача</th>
	            <th>Застройщик</th>
	            <th>Материал</th>
	            <th>Метро</th>
	        </tr>
	        </thead>
	        <tbody>
	            <?php
	            foreach ($vars['objects'] as $object) :
	                echo $object;
	            endforeach;
	            ?>
	        </tbody>
	    </table>
	 
	    <script type="text/javascript">
	        jQuery(function ($) {
	            $('.jsTableSorter').tablesorter({});
	        });
	    </script>
	 
	<?php endif;
	}
	 

  • 0

#2 Станислав

Станислав

Отправлено 10 August 2013 - 12:15   Лучший Ответ

Как-то так... (catalog.php в item_columns)
 

<?php
/**
 * JBZoo is universal CCK based Joomla! CMS and YooTheme Zoo component
 * @category   JBZoo
 * @author     smet.denis <admin@joomla-book.ru>
 * @copyright  Copyright (c) 2009-2012, Joomla-book.ru
 * @license    http://joomla-book.ru/info/disclaimer
 * @link       http://joomla-book.ru/projects/jbzoo JBZoo project page
 */
defined('_JEXEC') or die('Restricted access');

$this->app->jbassets->tablesorter();

// Запоминаем тип материала
$type = $this->app->jbrequest->get("type"); 

if ($vars['count']) :

   // Переключаем шапки в зависимости от вида материала
    switch ($type) {

       // Если ipotechnaya-programma
        case "ipotechnaya-programma":
        ?>

        <table class="jsTableSorter tablesorter">
        <thead>
        <tr>
            <th>Программа</th>
            <th>Банк</th>
            <th>Срок кредитования, лет</th>
            <th>Сумма кредита, тыс. руб</th>
            <th>Ставка до ОПС max, %</th>
            <th>Ставка после ОПС max, %</th>
            <th>Первоначальный взнос от, %</th>
        </tr>
        </thead>
        <tbody>
        <?php
        foreach ($vars['objects'] as $object) :
            echo $object;
        endforeach;
        ?>
        </tbody>
        </table>

        <? break;

       // Если novostrojki-predl
        case "novostrojki-predl":
        ?>
        <table class="jsTableSorter tablesorter">
        <thead>
        <tr>
            <th>Фото</th>
            <th>Адрес</th>
            <th>Район</th>
            <th>Сдача</th>
            <th>Застройщик</th>
            <th>Материал</th>
            <th>Метро</th>
        </tr>
        </thead>
        <tbody>
        <?php
        foreach ($vars['objects'] as $object) :
            echo $object;
        endforeach;
        ?>
        </tbody>
        </table>


        <? break;

       // Если что-то еще...
        case "SOMETHING_ELSE":
        ?>

        <table class="jsTableSorter tablesorter zebra">
        <!-- Еще один блок с шапкой -->
        </table>

        <? break;

    }

?>

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

<?php endif;


Сообщение отредактировал Станислав: 10 August 2013 - 12:16

  • 3

«Ну и зачем все это, лучше бы водки выпили». Из писем Белинского Гоголю.

 


#3 SmetDenis

SmetDenis

Отправлено 18 August 2013 - 18:51

tri, Пожалуйста, пользуйтесь тегом "code"
  • 0
JBZoo v4.0 и новый чудный мир Open Source GPL
Отключайте проверку лицензий как можно скорее!



— Есть два типа людей: Кто еще не делает бекапы и кто уже делает бекапы.





Click to return to top of page in style!