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


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

Проверка кастомного текста и отметка наличия [backend]


В этой теме нет ответов

#1 CB9TOIIIA

CB9TOIIIA

Отправлено 07 November 2016 - 09:48

Всем привет! Потребовалось проверять - есть ли в статьях опросы и вывести "птичку" в админке. Собственно решил поделиться решением:

 

Переопределяем zoo - файл default.php

  1. \administrator\templates\isis\html\com_zoo\item

Далее в нужном месте делаем столбец, в нашем примере будут теги и опросы (от advancepoll):

  1. <th class="poll">
  2. <?php echo "<center> Опрос </center>"; ?>
  3. </th>
  4. <th class="tags" style="width:50px; text-align:center;">
  5. <?php //echo "<center> Теги </center>";
  6. echo $this->app->html->_('grid.sort', 'Tags', 'tTag.item_id', @$this->lists['order_Dir'], @$this->lists['order']);
  7. ?>
  8. </th>

и ниже:

  1. <td class="poll">
  2. <?php
  3.  
  4. if (NULL != $row->getElement('<ELEMENT_ID>')) {
  5. $checkpoll = $row->getElement('<ELEMENT_ID>')->data();
  6. $checkpolltxt = $this->app->data->create($checkpoll);
  7. $valuepolltxt = $checkpolltxt->find('0.value', 'default_value');
  8. $valuepolltxtpreg = preg_match('/advpoll/',$valuepolltxt);
  9. if ($valuepolltxtpreg == 1) {
  10. echo "<center><img src='/administrator/components/com_zoo/assets/images/tick.png' width='16' height='16' border='0' alt='Да'></center>";
  11. }
  12. else {
  13. echo "";
  14. }
  15. }
  16.  
  17. ?>
  18.  
  19. </td>
  20. <td class="tags">
  21. <?php $tagsmas = $row->getTags();
  22. if (isset($tagsmas[0])) {
  23. echo "<center><img src='/administrator/components/com_zoo/assets/images/tick.png' width='16' height='16' border='0' alt='Да'></center>";
  24. } else {
  25.  
  26. }
  27. ?>
  28. </td>
0_a8a84_73968f8e_orig.png
 
Готово :)

  • 2




Click to return to top of page in style!