S
S
Stanislav2021-10-30 17:30:23
MODX
Stanislav, 2021-10-30 17:30:23

How to display a list of materials from the current category on a separate page?

Can you please tell me how to display a list of materials from one category on a separate page?

Conditions:
Each post has its own template with the "author" TV-field.
Each author's page also has its own template.
On the page of each article at the end there is a link that should display all the materials of the current author.

In the post template I use:



In a chunk I use:
<a href="">Все статьи </a>

As a result, the page of the first author on the site is displayed, and not the page of the current author.
I do not know what to do. Help me please.

I am attaching an example diagram:

617d565e289d3208370981.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
weranda, 2021-10-30
@weranda

What do you output? - I'll describe.

&parents=`0` — (любые ресурсы)
&templates=`7` — (этим вы что делаете?)
&limit=`1` — (ограничиваете количиство ресурсов (выводите один))
&tpl=`link_current_author` — (указываете шаблон для вывода)
&includeTVs=`author` — (выбираете поле author)

What do you need to output? - If you have several categories, for example, pears (1), apples (2), bananas (3); in each category you have n resources. And in a resource located in the banana category, you want to display resources from this category, then you just need to specify the correct parent. Not "0", but "3".

D
Danny Arty, 2021-10-30
@DanArst

On the page of each article at the end there is a link that should display all the materials of the current author.

those. this link should lead to the Author's page right? And the author is the parent resource for his articles? And how is the author indicated in TV for articles - in the form of the author's id-resource?
upd.
Most likely I did not understand the question at first. Those. pdoResources in this case displays a link to the author's page?
I do not quite understand the essence of this question, perhaps the answer lies within it. It will take me some time to understand it.

Here in the chunk - the author of the article is specified as an id-resource or is the author's name there?
In any case, since you have pdoTools installed on your site, you can easily solve the problem using the parser without using the pdoResources snippet.
Given that the author is the parent resource for all his articles, you can display a link to it like this (insert this code instead of pdoResources):
<a href="0">Все статьи </a>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question