Posted 24 ноября, 20212 yr comment_175111 Кто ни будь пытался вывести например через виджет последние комментарии из баз данных? Так же как и с другими классами не получится загрузить: $comments = \IPS\cms\Records\Comment::getItemsWithPermission( array( array( 'comment_approved=?', 1 ) ); Link to comment https://ipbmafia.ru/topic/23820-poslednie-kommentarii/ Share on other sites Больше вариантов
24 ноября, 20212 yr Author comment_175133 Вывел комментарии таким образом: $databaseid = 1; $class = 'IPS\cms\Records\Comment' . $databaseid; $where = array(); $where[] = array( $class::$databasePrefix . $class::$databaseColumnMap['approved'] . '=?', 1 ); $where[] = array( $class::$databasePrefix . 'database_id=?', $databaseid ); $orderType = 'DESC'; $limit = 2; $comments = $class::getItemsWithPermission( $where, $class::$databasePrefix . $class::$databaseColumnMap['date'] . ' ' . $orderType, $limit ); Собирает ActiveRecordIterator из 2 ($limit) последних (DESC) одобренных комментариев из базы с ID 1 ($databaseid) . Далее просто итерациями выводим комментарии. Edited 24 ноября, 20212 yr by ZIKURIK Link to comment https://ipbmafia.ru/topic/23820-poslednie-kommentarii/?&do=findComment&comment=175133 Share on other sites Больше вариантов
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.