K
K
Kalwin UA2020-06-16 11:06:36
MODX
Kalwin UA, 2020-06-16 11:06:36

How to display content?

Guys help to display a table with content:
So the table view:
5ee87ad658211996154581.png
I create documents with content
5ee87b42e215d803717711.png
Where, for example, in the document "Price List" I write out:

<h2 class="w-100 text-center">Вопрос</h2>
<div class="table-responsive-sm">
    <table class="table table-bordered table-hover table-sm">
        <caption>Ждем ваших звонков и сообщений!</caption>
        <thead class="thead-dark">
            <tr>
                <th scope="col" class="align-middle text-left">Наиминование</th>
                <th scope="col" class="align-middle text-center">Ед. изм.</th>
                <th scope="col" class="align-middle text-center">Цена, грн</th>
                <th scope="col" class="align-middle text-center">Цена, грн нов</th>
                <th scope="col" class="align-middle text-center">Цена, грн б/у</th>
                <th scope="col" class="align-middle text-center">до 0,5</th>
                <th scope="col" class="align-middle text-center">от 1кг</th>
                <th scope="col" class="align-middle text-center">от 5кг</th>
                <th scope="col" class="align-middle text-center">Вес</th>
            </tr>
        </thead>
        
        </tbody>
    </table>
</div>

The TableTpl file itself
<tbody class="thead-ligt">
    <tr>
        <th scope="col" colspan="9" class="align-middle text-left"></th>
    </tr>
</tbody>

And the contents of PriceTpl
<tbody>
    <tr class="table-secondary">
        <th scope="row" class="align-middle text-left"><a href="" class="text-body"></a></th>
        <td class="align-middle text-center">грамм</td>
        <td class="align-middle text-center">-</td>
        <td class="align-middle text-center">-</td>
        <td class="align-middle text-center">-</td>
        <td class="align-middle text-center">9</td>
        <td class="align-middle text-center">9.4</td>
        <td class="align-middle text-center">9.8</td>
        <td class="align-middle text-center">-</td>
    </tr>
</tbody>

Then I get the result
5ee87c906cd8c850163731.png

PS: I understand that the output result is duplicated due to " &parents=`9`" in "TableTpl", but I don't understand how it would be automatically pulled from the nested document. Or, I'm not doing it right at all. Tell me how to solve the issue?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-06-16
@i__dmitry

1. It is better to use pdoResources from the pdoTools package, it is faster and more convenient. The parameters are generally the same.
2. In TableTpl, you need to write &parents=`121303` to pull the output from the desired document.
3. In general, it would be most logical to make one pdoResources output at the top level (document 2 - Price List), which will go through the child documents (&depth=`0`), and in the output template write another call to pdoResources, which will go through by nested documents (&parents=`121303`).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question