14-Oct-2019, 01:56 PM
Hello,
I have a Licence and Extractor.
How to display not Newest Comments, but Random 5 comments at sidebar of my website?
At extractor, I have changed this:
public function newestComments()
{
$html = '';
$comments = mysqli_query($this->getLink(), "SELECT `id` FROM `" . CMTX_DB_PREFIX . "comments` WHERE `is_approved` = '1' ORDER BY `date_added` DESC LIMIT 8");
to:
public function randomComments()
{
$html = '';
$comments = mysqli_query($this->getLink(), "SELECT `id` FROM `" . CMTX_DB_PREFIX . "comments` WHERE `is_approved` = '1' ORDER BY `date_added` DESC LIMIT 5");
However, I stiil got problems:
Fatal error: Cannot redeclare extractor:: substr() in /home/var/...domain/ets/
Fatal error: Cannot redeclare extractor:: shortenComment() in /home
At example file I have changed:
<?php $cmtx_folder = '/main/'; require_once $_SERVER['DOCUMENT_ROOT'] . '/main/extractor.php'; $extractor = new extractor($cmtx_folder); if ($extractor->isConnected()) {echo $extractor->randomComments();}?>
Please help Steven!
I have a Licence and Extractor.
How to display not Newest Comments, but Random 5 comments at sidebar of my website?
At extractor, I have changed this:
public function newestComments()
{
$html = '';
$comments = mysqli_query($this->getLink(), "SELECT `id` FROM `" . CMTX_DB_PREFIX . "comments` WHERE `is_approved` = '1' ORDER BY `date_added` DESC LIMIT 8");
to:
public function randomComments()
{
$html = '';
$comments = mysqli_query($this->getLink(), "SELECT `id` FROM `" . CMTX_DB_PREFIX . "comments` WHERE `is_approved` = '1' ORDER BY `date_added` DESC LIMIT 5");
However, I stiil got problems:
Fatal error: Cannot redeclare extractor:: substr() in /home/var/...domain/ets/
Fatal error: Cannot redeclare extractor:: shortenComment() in /home
At example file I have changed:
<?php $cmtx_folder = '/main/'; require_once $_SERVER['DOCUMENT_ROOT'] . '/main/extractor.php'; $extractor = new extractor($cmtx_folder); if ($extractor->isConnected()) {echo $extractor->randomComments();}?>
Please help Steven!