Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question