Skip to content

Instantly share code, notes, and snippets.

@Sentinel-7
Last active May 28, 2021 17:15
Show Gist options
  • Save Sentinel-7/9abed85da48f3d1164c9235820d6b424 to your computer and use it in GitHub Desktop.
Save Sentinel-7/9abed85da48f3d1164c9235820d6b424 to your computer and use it in GitHub Desktop.
Выборка json pdoResources
{set $output = '!pdoResources' | snippet: [
'parents' => '35|bb,39|bb'
'limit' => 0,
'includeTVs' => 'block_image',
'tvPrefix' => '',
'sortby' => '{ "menuindex":"ASC" }',
'where' => '{"parent:IN":[35|bb,39|bb]}',
'return' => 'json',
'select' => 'id,pagetitle,parent'
]}
{foreach $output|fromJSON as $item}
{if $item.parent == 35|bb}
<li class="list-inline-item">
<a href="{$item.id|url}">
<div class="big-catalog-item">
<div class="catalog-bottom-tag m-4">
<span class="catalog-big-title">{$item.pagetitle}</span>
</div>
{set $im = ($item.block_image ? $item.block_image : '/template/images/teambe.jpg') | pthumb
: "w=570&h=330&zc=1&far=1&bg=ffffff&q=75&f=webp"}
<picture>
<source data-srcset="{$im}" type="image/webp">
<img class="lazy" data-src="{$im}" alt="{$item.pagetitle}">
</picture>
</div>
</a>
</li>
{/if}
{/foreach}
{set $output = '!pdoResources' | snippet: [
'parents' => 10
'limit' => 0,
'includeTVs' => 'img,product,intro',
'tvPrefix' => '',
'return' => 'json',
'select' => 'id,uri,pagetitle,introtext,parent,publishedon'
] | fromJSON}
{$output|print_r}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment