Created
September 5, 2016 15:14
-
-
Save antk25/bd9c879f8e75e242f59aac0190d26c8e to your computer and use it in GitHub Desktop.
1. Чтобы вывести количество комментариев в компоненте Tickets для MODx Revo необходимо написать сниппет, так как из коробки данного сниппета нет. Создадим сниппет TicketCommentsCount со следующим кодом:
2. Далее нам достаточно вызвать сниппет с параметром 'id', в котором указывается ресурс, у которого нужно узнать количество комментариев. Пример…
This file contains hidden or 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 | |
if ($thread = $modx->getObject('TicketThread', array('resource' => $id))) { | |
echo $thread->get('comments'); | |
} |
This file contains hidden or 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
[[!TicketCommentsCount? &id=`164`]] | |
[[!TicketCommentsCount? &id=``]] | |
[[!TicketCommentsCount? &id=`2`]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment