Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Template tags for table of recent posts?
Avatar
Peter
Member
Free Members
sp_UserOfflineSmall Offline
Sep 9, 2012 - 10:58 pm

Hi,

Is there a template tag in 5.1.3 that can produce table displays similar to sf_recent_posts_expanded() from 4.x? It output table displays of topics that were recently posted to, with a parameter for the forum ID (defaulting to ALL forums) and a parameter for the number of topics to show. The table display for topics with most recent posts across all forums would look like the home page of http://www.highinterestsavings.ca/

Avatar
Jakob Smith
Copenhagen, Denmark
Member
Free Members
sp_UserOfflineSmall Offline
Sep 10, 2012 - 7:32 am

I'm on the lookout for exactly the same thing, so  following this thread.

I need to show a table with the 5 most recent posts with topic, forum, author and date. Tried tweaking the Recent Forum Posts widget but it didn't work.

The table is to be shown in a widget on a frontpage with lots of other widgets. PHP code will be fine.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 10, 2012 - 9:26 am

I think this should be what you are looking for:

http://codex.simple-press.com/.....ent-posts/

Also available as a widget.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Jakob Smith
Copenhagen, Denmark
Member
Free Members
sp_UserOfflineSmall Offline
Sep 10, 2012 - 12:21 pm

Thank you.

Using the shortcode + CSS, I ended up building a table-like structure, which fits my need.

I found out that I can put HTML into the befores and afters:

sp_recent_posts itemorder='TFUD' limit='4'
beforeTopic='<div class="spdebatforside-emne">' afterTopic='</div>' 
beforeForum='<div class="spdebatforside-forum">' afterForum='</div>' 
beforeUser='<div class="spdebatforside-navn">' afterUser='</div>' 
beforeDate='<div class="spdebatforside-dato">' afterDate='</div>'

Around this I'm putting other HTML to build the rest of the structure. It is all put into a content block using Custom Post Widget and they I insert the content block in the right widget area on the frontpage.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 10, 2012 - 12:49 pm

Getting quite fascinated to see this site :)

andy-signature.png
YELLOW
SWORDFISH
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 10, 2012 - 8:15 pm

Peter, sorry, looks like your question got skipped...  No, we did not convert over the recent posts expanded template tag...  at least not in its current form...

the reason primarily being that with themes now, we didnt come up with a particularly slick method of making it look the same... with v4 skins, we pretty much knew how it would look...

with v5 now and themes, the recent posts and other similar tags, use a template file for styling the output...  so you could redo the default template file that we provide and try to make the style identical...  not sure all the data is available in the class, but if not its easily added with a couple filters and hooks...

I should add that the recent posts tag does take a specific forum id if desire and limit the recent topics to that forum..  and number of topics...  it does everything you want, I believe, except duplicate the output styling of the forum...  but that is customizable as mentioned in above paragraph...

Avatar
Peter
Member
Free Members
sp_UserOfflineSmall Offline
Sep 11, 2012 - 7:02 pm

In modifying sp_RecentPostsTag() to add some extra information, I encountered what I think is a bug around showing first post information in the spTopicList class: in sp_listview_query(), first post information is loaded via:

$first = spdb_table(SFPOSTS, "topic_id=$r->topic_id AND post_index=1", 'row');

Then the display name is accessed via:

$list[$t]->first_display_name = sp_filter_name_display($first->display_name);

However, the display name is not stored in the posts table, so this is always blank. Presumably the original fetch needs to join the user ID to the members table OR we would just do a conditional extra database query if the user ID isn't NULL?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 12, 2012 - 3:36 am

Are we looking at the same thing? The sp-list-topic-class.php file? Because the $first data object is populated with the following query:

spdb_select('row', 'SELECT * FROM '.SFPOSTS.' JOIN '.SFMEMBERS.' ON '.SFMEMBERS.'.user_id = '.SFPOSTS.".user_id WHERE topic_id=$r->topic_id AND post_index=1");

on code line 255 of the most recent file?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Peter
Member
Free Members
sp_UserOfflineSmall Offline
Sep 12, 2012 - 9:34 am

Looks like it has been fixed for the next version :)

http://mantis.simple-press.com.....hp?id=3251

Is the pasted code the full extent of the fix?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 12, 2012 - 9:46 am

Ah yes - you are quite correct. I didn't know that!
Yes that was the only change.
But it isn't really very efficient going off and making a db call with a join for every row... I need to look at that...

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17363
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625