TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,163
  • Total Topics: 21,351
  • Online today: 816
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online

Random article in Frontpage block

Started by sanax, February 02, 2007, 08:52:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sanax

#10
Thanks Deni, works great

Remote images by using an img URL... although I see images located on my server do show up in the intro. I'll check it out!

Thanks for the help!! :)

Rafferty

Tried this and seems to only display the heading of the article with a link. What if the full article is wanting to be displayed as the feature article does.

JPDeni

#12
Quote
What if the full article is wanting to be displayed

Then you display the full article. Use the code above, but change


echo '<a href="' , $scripturl , '?page=' , $row['id'] , '">Read full article</a>';


to


echo html_entity_decode($row['body']);

Rafferty

Thank you. That displayed the articles at least but all articles were displayed on the front page one after the other


Rafferty

#15
Quoteglobal $db_prefix, $scripturl;

$query = db_query(
    "SELECT id, intro, subject
     FROM {$db_prefix}tp_articles
     ORDER BY rand()
     LIMIT 1", __FILE__, __LINE__);

$row = mysql_fetch_assoc($query);

echo $row['subject'] , ' - ' , $row['intro'] , '
';
echo $row['body'];

JPDeni

Your code is correct and will not show all of your articles. It's something else that's doing that -- some other setting.

Mick

What kind of block this code goes to?   ssi block?

Rafferty


JPDeni


This website is proudly hosted on Crocweb Cloud Website Hosting.