Last active
January 2, 2016 14:46
-
-
Save zhabinka/a6c1a905614fa025c226 to your computer and use it in GitHub Desktop.
Вывод документов с определённым значением TV.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$tvs = $modx->getCollection('modTemplateVarResource', array('tmplvarid' => 2, 'value' => 1)); | |
if (count($tvs) > 4) return 'Найдено больше 4 документов'; | |
foreach ($tvs as $tv) { | |
$res = $tv->getOne('Resource'); | |
$output .= '<p><b>' .$res->get('pagetitle'). '.</b> ' .$res->get('introtext'). ' (' .$res->get('publishedon'). ')</p>'; | |
} | |
return $output; |
Author
zhabinka
commented
Jan 2, 2016
- Корявый вариант.
- Вариант с использованием метода getTVValue.
- С использованием связей и метода getOne.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment