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


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

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


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

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

  1. <?php
  2. /**
  3. * JBZoo is universal CCK based Joomla! CMS and YooTheme Zoo component
  4. * @category JBZoo
  5. * @author smet.denis <admin@joomla-book.ru>
  6. * @copyright Copyright (c) 2009-2012, Joomla-book.ru
  7. * @license http://joomla-book.ru/info/disclaimer
  8. * @link http://joomla-book.ru/projects/jbzoo JBZoo project page
  9. */
  10. defined('_JEXEC') or die('Restricted access');
  11.  
  12. $this->app->jbassets->tablesorter();
  13.  
  14. // Запоминаем тип материала
  15. $type = $this->app->jbrequest->get("type");
  16.  
  17. if ($vars['count']) :
  18.  
  19. // Переключаем шапки в зависимости от вида материала
  20. switch ($type) {
  21.  
  22. // Если ipotechnaya-programma
  23. case "ipotechnaya-programma":
  24. ?>
  25.  
  26. <table class="jsTableSorter tablesorter">
  27. <thead>
  28. <tr>
  29. <th>Программа</th>
  30. <th>Банк</th>
  31. <th>Срок кредитования, лет</th>
  32. <th>Сумма кредита, тыс. руб</th>
  33. <th>Ставка до ОПС max, %</th>
  34. <th>Ставка после ОПС max, %</th>
  35. <th>Первоначальный взнос от, %</th>
  36. </tr>
  37. </thead>
  38. <tbody>
  39. <?php
  40. foreach ($vars['objects'] as $object) :
  41. echo $object;
  42. endforeach;
  43. ?>
  44. </tbody>
  45. </table>
  46.  
  47. <? break;
  48.  
  49. // Если novostrojki-predl
  50. case "novostrojki-predl":
  51. ?>
  52. <table class="jsTableSorter tablesorter">
  53. <thead>
  54. <tr>
  55. <th>Фото</th>
  56. <th>Адрес</th>
  57. <th>Район</th>
  58. <th>Сдача</th>
  59. <th>Застройщик</th>
  60. <th>Материал</th>
  61. <th>Метро</th>
  62. </tr>
  63. </thead>
  64. <tbody>
  65. <?php
  66. foreach ($vars['objects'] as $object) :
  67. echo $object;
  68. endforeach;
  69. ?>
  70. </tbody>
  71. </table>
  72.  
  73.  
  74. <? break;
  75.  
  76. // Если что-то еще...
  77. case "SOMETHING_ELSE":
  78. ?>
  79.  
  80. <table class="jsTableSorter tablesorter zebra">
  81. <!-- Еще один блок с шапкой -->
  82. </table>
  83.  
  84. <? break;
  85.  
  86. }
  87.  
  88. ?>
  89.  
  90. <script type="text/javascript">
  91. jQuery(function ($) {
  92. $('.jsTableSorter').tablesorter({});
  93. });
  94. </script>
  95.  
  96. <?php endif;
  97.  
Перейти к сообщению


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

#1 tri

tri

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

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

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



  1. <?php
  2. /**
  3.  * JBZoo is universal CCK based Joomla! CMS and YooTheme Zoo component
  4.  * @category   JBZoo
  5.  * @author     smet.denis <admin@joomla-book.ru>
  6.  * @copyright  Copyright (c) 2009-2012, Joomla-book.ru
  7.  * @license    [url=http://joomla-book.ru/info/disclaimer]http://joomla-book.ru/info/disclaimer[/url]
  8.  * @link       [url=http://joomla-book.ru/projects/jbzoo]http://joomla-book.ru/projects/jbzoo[/url] JBZoo project page
  9.  */
  10. defined('_JEXEC') or die('Restricted access');
  11. if (JRequest::getVar('type') == 'ipotechnaya-programma') {
  12. $this->app->jbassets->tablesorter();
  13.  
  14. if ($vars['count']) : ?>
  15.     <table class="jsTableSorter tablesorter">
  16.         <thead>
  17.         <tr>
  18.             <th>Программа</th>
  19.             <th>Банк</th>
  20.             <th>Срок кредитования, лет</th>
  21.             <th>Сумма кредита, тыс. руб</th>
  22.             <th>Ставка до ОПС max, %</th>
  23.             <th>Ставка после ОПС max, %</th>
  24.             <th>Первоначальный взнос от, %</th>
  25.         </tr>
  26.         </thead>
  27.         <tbody>
  28.             <?php
  29.             foreach ($vars['objects'] as $object) :
  30.                 echo $object;
  31.             endforeach;
  32.             ?>
  33.         </tbody>
  34.     </table>
  35.  
  36.     <script type="text/javascript">
  37.         jQuery(function ($) {
  38.             $('.jsTableSorter').tablesorter({});
  39.         });
  40.     </script>
  41.  
  42. <?php endif;
  43. } else {
  44. $this->app->jbassets->tablesorter();
  45.  
  46. if ($vars['count']) : ?>
  47.     <table class="jsTableSorter tablesorter">
  48.         <thead>
  49.         <tr>
  50.             <th style="width:110px;">Фото</th>
  51.             <th>Адрес</th>
  52.             <th>Район</th>
  53.             <th>Сдача</th>
  54.             <th>Застройщик</th>
  55.             <th>Материал</th>
  56.             <th>Метро</th>
  57.         </tr>
  58.         </thead>
  59.         <tbody>
  60.             <?php
  61.             foreach ($vars['objects'] as $object) :
  62.                 echo $object;
  63.             endforeach;
  64.             ?>
  65.         </tbody>
  66.     </table>
  67.  
  68.     <script type="text/javascript">
  69.         jQuery(function ($) {
  70.             $('.jsTableSorter').tablesorter({});
  71.         });
  72.     </script>
  73.  
  74. <?php endif;
  75. }
  76.  
 
Извиняюсь за флуд, вопрос не обязательно к разработчикам, может кто знающий php подскажет, как должно выглядеть, если условий несколько, я очень не силен в этом
 
 
  1. <?php
  2. /**
  3.  * JBZoo is universal CCK based Joomla! CMS and YooTheme Zoo component
  4.  * @category   JBZoo
  5.  * @author     smet.denis <admin@joomla-book.ru>
  6.  * @copyright  Copyright (c) 2009-2012, Joomla-book.ru
  7.  * @license    [url=http://joomla-book.ru/info/disclaimer]http://joomla-book.ru/info/disclaimer[/url]
  8.  * @link       [url=http://joomla-book.ru/projects/jbzoo]http://joomla-book.ru/projects/jbzoo[/url] JBZoo project page
  9.  */
  10. defined('_JEXEC') or die('Restricted access');
  11. if (JRequest::getVar('type') == 'ipotechnaya-programma') {
  12. $this->app->jbassets->tablesorter();
  13.  
  14. if ($vars['count']) : ?>
  15.     <table class="jsTableSorter tablesorter">
  16.         <thead>
  17.         <tr>
  18.             <th>Программа</th>
  19.             <th>Банк</th>
  20.             <th>Срок кредитования, лет</th>
  21.             <th>Сумма кредита, тыс. руб</th>
  22.             <th>Ставка до ОПС max, %</th>
  23.             <th>Ставка после ОПС max, %</th>
  24.             <th>Первоначальный взнос от, %</th>
  25.         </tr>
  26.         </thead>
  27.         <tbody>
  28.             <?php
  29.             foreach ($vars['objects'] as $object) :
  30.                 echo $object;
  31.             endforeach;
  32.             ?>
  33.         </tbody>
  34.     </table>
  35.  
  36.     <script type="text/javascript">
  37.         jQuery(function ($) {
  38.             $('.jsTableSorter').tablesorter({});
  39.         });
  40.     </script>
  41.  
  42. <?php endif;
  43. if (JRequest::getVar('type') == 'novostrojki-predl') {
  44. $this->app->jbassets->tablesorter();
  45. if ($vars['count']) : ?>
  46. <table class="jsTableSorter tablesorter">
  47. <thead>
  48. <tr>
  49. <th>Фото</th>
  50. <th>Адрес</th>
  51. <th>Район</th>
  52. <th>Сдача</th>
  53. <th>Застройщик</th>
  54. <th>Материал</th>
  55. <th>Метро</th>
  56. </tr>
  57. </thead>
  58. <tbody>
  59. <?php
  60. foreach ($vars['objects'] as $object) :
  61. echo $object;
  62. endforeach;
  63. ?>
  64. </tbody>
  65. </table>
  66. <script type="text/javascript">
  67. jQuery(function ($) {
  68. $('.jsTableSorter').tablesorter({});
  69. });
  70. </script>
  71. <?php endif;
  72.  
  73.  
  74. } else {
  75. $this->app->jbassets->tablesorter();
  76.  
  77. if ($vars['count']) : ?>
  78.     <table class="jsTableSorter tablesorter">
  79.         <thead>
  80.         <tr>
  81.             <th style="width:110px;">Фото</th>
  82.             <th>Адрес</th>
  83.             <th>Район</th>
  84.             <th>Сдача</th>
  85.             <th>Застройщик</th>
  86.             <th>Материал</th>
  87.             <th>Метро</th>
  88.         </tr>
  89.         </thead>
  90.         <tbody>
  91.             <?php
  92.             foreach ($vars['objects'] as $object) :
  93.                 echo $object;
  94.             endforeach;
  95.             ?>
  96.         </tbody>
  97.     </table>
  98.  
  99.     <script type="text/javascript">
  100.         jQuery(function ($) {
  101.             $('.jsTableSorter').tablesorter({});
  102.         });
  103.     </script>
  104.  
  105. <?php endif;
  106. }
  107.  

  • 0

#2 Станислав

Станислав

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

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

  1. <?php
  2. /**
  3. * JBZoo is universal CCK based Joomla! CMS and YooTheme Zoo component
  4. * @category JBZoo
  5. * @author smet.denis <admin@joomla-book.ru>
  6. * @copyright Copyright (c) 2009-2012, Joomla-book.ru
  7. * @license http://joomla-book.ru/info/disclaimer
  8. * @link http://joomla-book.ru/projects/jbzoo JBZoo project page
  9. */
  10. defined('_JEXEC') or die('Restricted access');
  11.  
  12. $this->app->jbassets->tablesorter();
  13.  
  14. // Запоминаем тип материала
  15. $type = $this->app->jbrequest->get("type");
  16.  
  17. if ($vars['count']) :
  18.  
  19. // Переключаем шапки в зависимости от вида материала
  20. switch ($type) {
  21.  
  22. // Если ipotechnaya-programma
  23. case "ipotechnaya-programma":
  24. ?>
  25.  
  26. <table class="jsTableSorter tablesorter">
  27. <thead>
  28. <tr>
  29. <th>Программа</th>
  30. <th>Банк</th>
  31. <th>Срок кредитования, лет</th>
  32. <th>Сумма кредита, тыс. руб</th>
  33. <th>Ставка до ОПС max, %</th>
  34. <th>Ставка после ОПС max, %</th>
  35. <th>Первоначальный взнос от, %</th>
  36. </tr>
  37. </thead>
  38. <tbody>
  39. <?php
  40. foreach ($vars['objects'] as $object) :
  41. echo $object;
  42. endforeach;
  43. ?>
  44. </tbody>
  45. </table>
  46.  
  47. <? break;
  48.  
  49. // Если novostrojki-predl
  50. case "novostrojki-predl":
  51. ?>
  52. <table class="jsTableSorter tablesorter">
  53. <thead>
  54. <tr>
  55. <th>Фото</th>
  56. <th>Адрес</th>
  57. <th>Район</th>
  58. <th>Сдача</th>
  59. <th>Застройщик</th>
  60. <th>Материал</th>
  61. <th>Метро</th>
  62. </tr>
  63. </thead>
  64. <tbody>
  65. <?php
  66. foreach ($vars['objects'] as $object) :
  67. echo $object;
  68. endforeach;
  69. ?>
  70. </tbody>
  71. </table>
  72.  
  73.  
  74. <? break;
  75.  
  76. // Если что-то еще...
  77. case "SOMETHING_ELSE":
  78. ?>
  79.  
  80. <table class="jsTableSorter tablesorter zebra">
  81. <!-- Еще один блок с шапкой -->
  82. </table>
  83.  
  84. <? break;
  85.  
  86. }
  87.  
  88. ?>
  89.  
  90. <script type="text/javascript">
  91. jQuery(function ($) {
  92. $('.jsTableSorter').tablesorter({});
  93. });
  94. </script>
  95.  
  96. <?php endif;
  97.  

Сообщение отредактировал Станислав: 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!