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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,970
  • Latest: bynw
Stats
  • Total Posts: 196,055
  • Total Topics: 21,337
  • Online today: 194
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 172
  • Total: 172

Articles in a block

Started by othg_weasel, October 30, 2008, 02:05:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

othg_weasel

Hello again,

I am now running TP1.0.6 SMF 1.1.6 . I want to use a block to show a article. in tp 9.xx its added very easy throught the block menu. I have read http://docs.tinyportal.co.uk/index.php?topic=70 that show you how to do this but in the block menu there is no "articlebox" to chose from in there? is there a new way of doing this?

IchBin

The article/category options were removed. I'm sure they'll be back in another release. In the mean time you'll need to do it another way. Possibly even use a code snippet to get what you want.

othg_weasel

eeek!! ok thank you for your reply. if anyone might have an idea on how to achieve this I'm all ears... 

JPDeni

#3
You're wanting to display the contents of an html article in a block?

I think this would work... Make a php block. Put this in it:


global $db_prefix;

$article_number = 20; // Fill in the number of the article you want to display.

$query = db_query(
    "SELECT *
     FROM {$db_prefix}tp_articles
     WHERE id = " . $article_number . "
     ", __FILE__, __LINE__);

if(db_affected_rows() != 0)
{
  while ($row = mysql_fetch_assoc($query))
  {
    echo $row['body'];
  }
}
else
  echo "Incorrect article number entered."


This won't work for BBC articles or php articles. Only html articles.

You can also add things other than the article body, if you want.

othg_weasel

wow thank you so much I'll try that as soon as I get back home.
I'll let you know how it works out.

Again thank you!

JPDeni

I had made an error. I've fixed it.

wildcard

Quote from: IchBinâ,,¢ on October 30, 2008, 03:01:25 PM
The article/category options were removed. I'm sure they'll be back in another release. In the mean time you'll need to do it another way. Possibly even use a code snippet to get what you want.

Any reason they were removed for 1.0.6?

IchBin

Because its beta, and many things change. That is all.

This website is proudly hosted on Crocweb Cloud Website Hosting.