[[+content_image]]
H
H
HitGirl2019-04-02 12:04:23
CMS
HitGirl, 2019-04-02 12:04:23

How to remove news image from news list in MODX?

Hello!
To display news, I use the following piece of template code:

<div class="row">
      <div class="col">
        <div class ="header">
          <h1 id = "header">Вопрос</h1>
        </div>
        <div class="content">
          <div>2022-05-18 11:53:00</div>
          <img src="">
          
        </div>
      </div>
    </div>

But this code is executed both for the page with the list of news and for a separate news item.
As a result, unnecessary pictures and inscriptions appear on the news page. Please tell me how to remove them from the news list page, but leave them for pages with separate news?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
I
Ingvar Kuznets, 2019-04-02
@GariSun

There should be a hook to use the code only on selected pages. But I didn’t work with MODX, so I can’t tell you more precisely.

O
Oleg Spiridonov, 2019-08-19
@spd78

1. Well, do you have different templates for the news and for the list of news? Call this piece of code only in a separate news template.
2. If the template is the same, it is architecturally incorrect, most likely (it's hard to say for sure without looking). Make a separate template for displaying a page with a list of news and then see step 1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question