E
E
Elena2019-02-19 20:48:01
MODX
Elena, 2019-02-19 20:48:01

How to display migx fields in pdoresources output via fenom?

There is no way to display migx fields in pdoresources output via fenom. pdoresouces output:

{'!pdoResources'|snippet:[
                'parents' => '5',
                'depth' => '0',
                'includeTVs' => 'avto_slide,char_avto',
                'tvPrefix' => '',
                'tpl' => 'avto-tpl'
            ]}

does not output. I don't understand what's wrong here.
autotpl:
<div class="section-5_content-wrap">
                    <div class="section-5_content flex">
                        {if $_modx->resource.avto_slide}
                            <div class="section-5_slider-wrap">
                                <div id="section-5_slider" class="owl-carousel">
                                    {set $rows = json_decode($_modx->resource.avto_slide, true)}
                                    {foreach $rows as $row}
                                        <picture class="section-5_img">
                                            <img src="{$row.avto_img}" alt="{$row.avto_title}">
                                        </picture>
                                    {/foreach}
                                </div>
                                <div class="section-5_slider_dots flex"></div>
                            </div>
                        {/if}
                        <div class="section-5_text">
                            <p class="section-5_text-title">Характеристика<br>
                                авто</p>
                           {resource:'char_avto'}
                        </div>
                    </div>
                    <div class="section-btn">
                        <button class="btn-order" onclick="location.href=''">Забронировать авто</button>
                    </div>
                </div>

avto_slide - migx field.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DarWiM, 2019-02-28
@DarWiM

Corrected, for the case when tvPrefix = ''

<div class="section-5_content-wrap">
  <div class="section-5_content flex">
    {if $avto_slide}
      <div class="section-5_slider-wrap">
        <div id="section-5_slider" class="owl-carousel">
          {set $rows = $avto_slide | json_decode}
          {foreach $rows as $row}
            <picture class="section-5_img">
              <img src="{$row.avto_img}" alt="{$row.avto_title}">
            </picture>
          {/foreach}
        </div>
        <div class="section-5_slider_dots flex"></div>
      </div>
    {/if}
    <div class="section-5_text">
      <p class="section-5_text-title">Характеристика<br>
        авто</p>
       {$char_avto}
    </div>
  </div>
  <div class="section-btn">
    <button class="btn-order" onclick="location.href='{16 | url}'">Забронировать авто</button>
  </div>
</div>

A
Anton, 2019-02-19
@BiOpSIhoS

$_modx->resource.avto_slide - this is the current resource field.
If you need to take it from pdoResources, then you just need $avto_slide
The ratio of modx tags and fenom tags:
{resource:'char_avto'} - here, you probably also need just {$char_avto}
If char_avto is a field of the current resource, then it must be included in includeTVs, and in the chunk write {$_modx->resource.char_avto}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question