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


Фотография
* * * * * 1 Голосов

Table

table template

Лучший Ответ SmetDenis , 05 June 2013 - 05:15

Hi

Create Item teaser template, as example

media/zoo/applications/jbuniversal/templates/catalog/renderer/item/<TYPE ALIAS>/teaser.php

<?php
defined('_JEXEC') or die('Restricted access');
?>
<tr class="table-row item_<?php echo $item->id;?>">
    <td><?php echo $item->id; ?></td>
    <td><?php echo $this->renderPosition('cell1'); ?></td>
    <td><?php echo $this->renderPosition('cell2'); ?></td>
    <td><?php echo $this->renderPosition('cell3'); ?></td>
    <td><?php echo $this->renderPosition('cell4'); ?></td>
    <td><?php echo $this->renderPosition('cell5'); ?></td>
</tr>
Define new placeholders in positions.xml
<?xml version="1.0" encoding="utf-8"?>
<renderer>

   <!-- add this block -->
   <positions layout="teaser">
        <position name="cell1">Table cell #1</position>
        <position name="cell2">Table cell #2</position>
        <position name="cell3">Table cell #3</position>
        <position name="cell4">Table cell #4</position>
        <position name="cell5">Table cell #5</position>
   </positions>
   <!-- /add this block -->

</renderer>

Create new template in

media/zoo/applications/jbuniversal/templates/catalog/renderer/item_columns/<APP ALIAS>.php
for example
<?php
defined('_JEXEC') or die('Restricted access');
$this->app->jbassets->tablesorter(); // include jQuery Tablesorter JS+CSS
 
if ($vars['count']) : ?>
    <table class="jsTableSorter tablesorter zebra">
        <caption>Table</caption>
        <thead>
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Image</th>
            <th>Field #1</th>
            <th>Field #2</th>
            <th>Field #3</th>
        </tr>
        </thead>
        <tbody>
            <?php
            foreach ($vars['objects'] as $object) :
                echo $object;
            endforeach;
            ?>
        </tbody>
 
    </table>
 
    <!-- table sorter jQuery plugin -->
    <script type="text/javascript">
        jQuery(function ($) {
            $('.jsTableSorter').tablesorter({});
        });
    </script>
<?php endif;
Also you can choose template in category configurations
ssmbb017cb4_200x0.png Перейти к сообщению


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

#1 Micke

Micke

Отправлено 04 June 2013 - 21:08

Hello
Im trying to make a table with searchable fields
Which template layout should I use to get that result?
 
/Micke
  • 0

#2 SmetDenis

SmetDenis

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

Hi

Create Item teaser template, as example

media/zoo/applications/jbuniversal/templates/catalog/renderer/item/<TYPE ALIAS>/teaser.php
<?php
defined('_JEXEC') or die('Restricted access');
?>
<tr class="table-row item_<?php echo $item->id;?>">
    <td><?php echo $item->id; ?></td>
    <td><?php echo $this->renderPosition('cell1'); ?></td>
    <td><?php echo $this->renderPosition('cell2'); ?></td>
    <td><?php echo $this->renderPosition('cell3'); ?></td>
    <td><?php echo $this->renderPosition('cell4'); ?></td>
    <td><?php echo $this->renderPosition('cell5'); ?></td>
</tr>
Define new placeholders in positions.xml
<?xml version="1.0" encoding="utf-8"?>
<renderer>

   <!-- add this block -->
   <positions layout="teaser">
        <position name="cell1">Table cell #1</position>
        <position name="cell2">Table cell #2</position>
        <position name="cell3">Table cell #3</position>
        <position name="cell4">Table cell #4</position>
        <position name="cell5">Table cell #5</position>
   </positions>
   <!-- /add this block -->

</renderer>

Create new template in

media/zoo/applications/jbuniversal/templates/catalog/renderer/item_columns/<APP ALIAS>.php
for example
<?php
defined('_JEXEC') or die('Restricted access');
$this->app->jbassets->tablesorter(); // include jQuery Tablesorter JS+CSS
 
if ($vars['count']) : ?>
    <table class="jsTableSorter tablesorter zebra">
        <caption>Table</caption>
        <thead>
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Image</th>
            <th>Field #1</th>
            <th>Field #2</th>
            <th>Field #3</th>
        </tr>
        </thead>
        <tbody>
            <?php
            foreach ($vars['objects'] as $object) :
                echo $object;
            endforeach;
            ?>
        </tbody>
 
    </table>
 
    <!-- table sorter jQuery plugin -->
    <script type="text/javascript">
        jQuery(function ($) {
            $('.jsTableSorter').tablesorter({});
        });
    </script>
<?php endif;
Also you can choose template in category configurations
ssmbb017cb4_200x0.png
  • 0
JBZoo v4.0 и новый чудный мир Open Source GPL
Отключайте проверку лицензий как можно скорее!



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


#3 Micke

Micke

Отправлено 06 June 2013 - 15:00

Thank you :-)

How do I change the width of the columns?

And how do I make the searchable fields above the columns?

 

/Michael


  • 0

#4 SmetDenis

SmetDenis

Отправлено 06 June 2013 - 17:37

Try to change style "width"
 
        <thead>
        <tr>
            <th style="witdh:50px;">ID</th> <!-- example -->
            <th>Name</th>
            <th>Image</th>
            <th>Field #1</th>
            <th>Field #2</th>
            <th>Field #3</th>
        </tr>
        </thead>
For search you must configure the JBZoo Filter Module and this template in Zoo
ssmb5ed1b96_200x0.png
  • 0
JBZoo v4.0 и новый чудный мир Open Source GPL
Отключайте проверку лицензий как можно скорее!



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


#5 Micke

Micke

Отправлено 07 June 2013 - 10:31

I made a reply to : forum@jbzoo.com


  • 0

#6 SmetDenis

SmetDenis

Отправлено 07 June 2013 - 16:34

Sorry, but I have not received anything. :(

Please send all messages via this forum.


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



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


#7 Micke

Micke

Отправлено 07 June 2013 - 16:55

I wrote

I dont know how to attach file here

 

Hi again
Thanks for your rapid answers :-)

As you can se in my attached picture I have 3 columns ( 2 textfields and 1 text area)
I want the visitor to make search with the 2 first columns. Choose star rating and category too find the criteria.
Can you please help me?

And, I don't know Why the search module don't work.

/Michael


  • 0

#8 SmetDenis

SmetDenis

Отправлено 08 June 2013 - 04:55

For attach file to message in this forum
ssmeee0d780_200x0.png

Please, give me a link to your site?
  • 0
JBZoo v4.0 и новый чудный мир Open Source GPL
Отключайте проверку лицензий как можно скорее!



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






Темы с аналогичным тегами table, template

Click to return to top of page in style!