Jump to content

Последние комментарии

Featured Replies

Кто ни будь пытался вывести например через виджет последние комментарии из баз данных? Так же как и с другими классами не получится загрузить:

$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

Вывел комментарии таким образом:

		$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 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.


Guest
Ответить в этой теме...

Последние посетители 0

  • No registered users viewing this page.