TinyPortal

Development => Block Codes => Topic started by: Lorazz on October 12, 2009, 05:57:07 AM

Title: Forum-Posts as a Frontpanel Block?
Post by: Lorazz on October 12, 2009, 05:57:07 AM
Hey there,

first of all, this is the current situation:

i am currently using the "Only forum-posts" option with two boards selected. (Limit of 5 Posts to be displayed on the frontpage)

now i'm wondering if it is possible to use this feature in combination with the frontpanel option,because that would allow a better and more inteligent usage of frontpage-space)
i guess a php block would be the best solution but i'm not that good in these things.
i tried to create a suitable frontpanel-block, but the only option i found was that "recent topics"-thing - and that is def. not the same^^

i'd be *very* happy if someone of you could help me out of this mess  O0
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: G6Cad on October 12, 2009, 06:01:06 AM
And we would be very happy if you could add more info according to our Posting Guidelines (http://www.tinyportal.net/index.php/topic,581)  :)
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: Lorazz on October 12, 2009, 06:12:29 AM
oh yea.
Link to my site: http://www.nilenia.de
SMF version: 1.1.10
TP version: 1.0 beta 4
Theme name and version: Outline Omega by Antechinus

i hope that's all i missed and i got the right board - it's about some block code^^

sorry bout that, i've been working on things all night long and can barely keep my eyes open.  :)
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: Freddy on October 12, 2009, 11:49:52 AM
So you basically just need a PHP block to do this then :

1) Get posts from two sets of  boards (not every board).
2) Ordered by most recent.
3) Display 5 of them in the block.

Then you will switch to using the front panel option so you can assemble it that way instead?

That's something that can be done :)

Just let me know if I got that right.
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: Lorazz on October 12, 2009, 12:48:56 PM
yeah that's what i'd like to bring to work.  :)
but it's essential that the block
- displays these posts sorted by the date these topics were started
- and just show up the initial postings
just like the news-post-behavior that is known from the "Only forum-posts" and
"Forum-posts and articles - sorted on date" options that can be used in the "Settings & Frontpage" Tab in TinyPortals Admin-Panel
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: Freddy on October 12, 2009, 01:06:02 PM
Ok I will work on this then.  I can't start right away as I have visitors in a bit then later I am busy, but I should be able to make a start today at some point.

Cheers  :)
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: Lorazz on October 12, 2009, 03:37:05 PM
thank you very much, that messege saves my day  :D
take all the time you need  :)
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: Freddy on October 13, 2009, 02:53:39 PM
No problem :)

After a bit of digging around I found the functions Bloc used to do that job, so the code turned out to be pretty simple, once I worked out how to use the functions.

I added the code to the block code board, you can find it here :

http://www.tinyportal.net/index.php/topic,31143.msg249024.html#msg249024
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: Lorazz on October 13, 2009, 07:35:59 PM
ohh well, thats awesome but i'm unable to view your posted link:
QuoteThe topic or board you are looking for appears to be either missing or off limits to you.
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: Freddy on October 13, 2009, 08:09:08 PM
LOL, sorry about that - we're in the midst of re-organising the block area.  Here's the code :

// *** Config ***

// Set the boards you want to pull from - comma seperated within quotes.
$boards = '1,2,3';

// Set the total number of posts to show.
$number = 5;

// Set the maximum number of characters to show in a post.
$length = 300;

// *** End of config ***


// Now the code...

$posts = array();

$posts = TP_boardNews($boards, $number, 0, $length);

foreach ($posts as $post)
{
TPpageLayout1($post, 0);
}
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: Lorazz on October 13, 2009, 09:41:15 PM
yezzz sir, thank you very much. once more you saved my day :D
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: Freddy on October 13, 2009, 09:45:55 PM
You are welcome  :)

Thanks for giving a clear explanation of what you wanted, it helps me no end.
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: Chair on May 16, 2010, 08:02:20 AM
Sorry for the gravedig, but is there any chance this code could be updated for TP5b1? It is exactly what I have been looking for, only it isn't compatible.

(error returned was "Fatal error: Call to undefined function TP_boardNews() in /home/speed64/public_html/ihackmyi/Sources/Load.php(2092) : eval()'d code(48) : eval()'d code on line 19")
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: Freddy on May 16, 2010, 04:03:32 PM
Looking in to this..
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: Freddy on May 16, 2010, 04:14:03 PM
Hmm it looks like the function TP_boardNews no longer exists as I can not find it.

Is that the case Bloc ?
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: Lorazz on June 09, 2010, 10:12:42 AM
yes and the "read more" thing on classic "entries on startpage/frontpage" is missing. so this would be once more a great alternative.
Title: Re: Forum-Posts as a Frontpanel Block?
Post by: WillyP on June 09, 2010, 06:24:29 PM
I have a test forum up here (http://www.test.planetdescent.net/), the POTD, Soupe and News blocks are all forum posts, using the same script the real site used with SMF 1. If this is what your looking for I'll post the script here.