Is anyone aware of an infusion/panel that provides random news posts? If so, where can I download it. I found a random articles infusion/panel but I don't have the coding skills to adapt it to pulling news posts.
Thanks for your response Chan. I am trying to adapt the random_articles_panel into a random_news_panel that will work with either 7.02.07 and/or 8.00.21.
I have tried to adapt the code from random_arcticles_panel and am making progress except that instead of pulling up the news_id from the random pull, it is pulling up all of the news items on the website. I will keep trying and will update the forum with my results.
if ((FUSION_SELF == 'news.php') && isset($_GET['readmore']) && isNum($_GET['readmore']))
list($news_subject) = dbarraynum(dbquery("SELECT news_subject from ".DB_NEWS." WHERE news_id=".$_GET['readmore']));
$rel_news_res = dbquery("SELECT news_id, news_subject, news_news, news_image FROM ".DB_NEWS." WHERE MATCH (news_subject) AGAINST ('".$news_subject."' IN BOOLEAN MODE) AND news_id != ".$_GET['readmore']." ORDER BY news_datestamp DESC LIMIT 10");
$langPanel['001'] = "Related News:";
$counter = 0;
$columns = 2; //number of columns per line
echo "<table width='100%'>\n<tr>\n";
while($news = dbarray($rel_news_res))
if ($counter != 0 && ($counter % $columns == 0)) // comment out if you want to output in one line
echo "<td width='50%'>\n";
echo "<table cellpadding='4' cellspacing='2' width='100%'>\n<tr>\n";
echo "<td><a href='".BASEDIR."news.php?readmore=".$news['news_id']."' alt='".$news['news_subject']."'><img src='".IMAGES_N."".$news['news_image']."' title='".$news['news_subject']."' width='96%' height='auto' /></a><strong><a href='".BASEDIR."news.php?readmore=".$news['news_id']."'>".trimlink(strip_tags(stripslashes($news['news_subject'])), 39)."</a></strong>".trimlink(strip_tags(stripslashes($news['news_news'])), 69)."</td>\n</tr>\n";
$counter++; // comment out if you want to output in one line
I have been able to adapt the random_articles_panel code to work with random_news_panel and it works by displaying one news item at a time randomly. I will try your code however zizub and see how that works.
Merged on 05/25/2019:
Zizub, after adding your code, all that was displayed were blank squares where I assume images were supposed to show. This is below the news article that I was trying to read. What images is it supposed to be pulling up?
Excuse me. I forgot to say that my news is slightly modified. My image in the thumbs (t1 and t2) folder is ignored.
This panel shows news with similar words in the title.
The panel shows images from the ..images/news/xxx.jpg folder.
The picture for the news is added via the button: Select file. See attached photo
You can view all discussion threads in this forum.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
Users who participated in discussion: afoster, Chan, zizub