This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Recent Comments..again
#1
Sad 

Hi
I'm testing Commentics and works well with Recent Comments..but I'd like, instead of the date,
PHP Code:
<?php 
echo $comment["name"] . " on <a href='" . $page["url"] . "'>" . $page["reference"] . "</a> at " . [b]date("g:ia (jS-M)", strtotime($comment["dated"]));[/b]
10/20 characters (best 2/3 words) of the written comments, I tried some changes.. but my skills are so limited Huh..is it possible? Rolleyes
tks in advance
regards
Reply
#2

Hi,

This will display the first 20 characters of the comment:

PHP Code:
<?php 
// Start of 'Recent Comments' **********************************************************************************************
echo "<h3>Recent Comments</h3>";

$comments = mysql_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `is_approved` = '1' ORDER BY `dated` DESC LIMIT 5");

while (
$comment = mysql_fetch_array($comments)) {

$page_query = mysql_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '" . $comment["page_id"] . "'");
$page = mysql_fetch_assoc($page_query);

$comment_snippet = $comment["comment"];
$comment_snippet = str_ireplace("<br />", " ", $comment_snippet);
$comment_snippet = str_ireplace("<p></p>", " ", $comment_snippet);
$comment_snippet = strip_tags($comment_snippet);
$comment_snippet = html_entity_decode($comment_snippet, ENT_QUOTES, 'UTF-8');
$comment_snippet = substr($comment_snippet, 0, 20);
$comment_snippet = htmlspecialchars($comment_snippet, ENT_NOQUOTES, 'UTF-8');

echo
$comment["name"] . " on <a href='" . $page["url"] . "'>" . $page["reference"] . "</a> said " . $comment_snippet;
echo
"<br/>";

}
// End of 'Recent Comments' ************************************************************************************************

Have you completed the interview?
Reply
#3

works fine thank you...
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by Steven
28-Mar-2023, 12:17 PM
Last Post by kooler
02-Aug-2013, 05:29 PM
Last Post by Steven
27-Jan-2013, 09:31 PM
Last Post by brande
23-Jan-2013, 07:08 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)