TinyPortal

Development => Support => Topic started by: othg_weasel on October 30, 2008, 02:05:16 PM

Title: Articles in a block
Post by: othg_weasel on October 30, 2008, 02:05:16 PM
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?
Title: Re: Articles in a block
Post by: 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.
Title: Re: Articles in a block
Post by: othg_weasel on October 30, 2008, 05:27:33 PM
eeek!! ok thank you for your reply. if anyone might have an idea on how to achieve this I'm all ears... 
Title: Re: Articles in a block
Post by: JPDeni on October 30, 2008, 07:55:02 PM
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.
Title: Re: Articles in a block
Post by: othg_weasel on October 31, 2008, 11:11:40 PM
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!
Title: Re: Articles in a block
Post by: JPDeni on November 01, 2008, 03:45:57 AM
I had made an error. I've fixed it.
Title: Re: Articles in a block
Post by: wildcard on November 01, 2008, 02:26:31 PM
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?
Title: Re: Articles in a block
Post by: IchBin on November 01, 2008, 09:02:15 PM
Because its beta, and many things change. That is all.