C
C
Cheizer2020-06-10 20:16:39
CMS
Cheizer, 2020-06-10 20:16:39

How to call a snippet in a template, rewrite for php snippet (MODX)?

Can you please tell me how to write this snippet call in MODX REVO in php?
(required for use in your php snippet)

{'!pdoResources' | snippet : [
    'limit' => 1,
  'loadModels' => 'tagger',
  'class' => 'TaggerTagResource',
    'leftJoin' => '{
     "NameTag": {
      "class": "TaggerTag",
      "on": "TaggerTagResource.tag = NameTag.id"
    },
    "Posts": {
      "class": "modResource",
      "on": "TaggerTagResource.resource = Posts.id"
    },
    "intronews": {
    "class": "modTemplateVarResource",
    "on": "Posts.id = intronews.contentid and intronews.tmplvarid = 20"
      },
  "autor": {
    "class": "modTemplateVarResource",
    "on": "Posts.id = autor.contentid and autor.tmplvarid = 19"
     },
     "image": {
    "class": "modTemplateVarResource",
    "on": "Posts.id = image.contentid and image.tmplvarid = 1"
     }
  }',
  'select' => '{
  "TaggerTagResource": "*",
    "NameTag": "NameTag.tag, NameTag.alias",
    "Posts": "Posts.id, Posts.pagetitle",
    "intronews": "intronews.value as intronews",
    "autor": "autor.value as autor",
    "image": "image.value as image"
  }',
    'where' => '{"NameTag.alias" : $row.tag }',
  'sortby' => 'createdon',
  'sortdir' => 'desc',
  'tplWrapper' => '@INLINE {$output}'
  'tpl' => '@INLINE news_block',
]}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2020-06-18
@ig0r74

https://docs.modx.com/current/en/extending-modx/mo...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question