Support Forum

how to show post content with sp_RecentPostsTag()

VT vikash tiwary
vikash tiwary
Member

i am using the sp_RecentPostsTag(); to show the recent posts of the forum.

and it is showing the recent posts in FTUD order.

but i want to show the content of that post also.

i have checked the all arguments of this function. there is many arguments to show the text before and after the topic.

but i want to show the content of that post with the post title.

is there is any other function or arguments to do so?

please help.

thanks.

21 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

No – we have not included the post content as an option – just as you see it in the tooltip – which is an excerpted and sanitised version. This is available to the function of course. I would not be against adding a filter to, say, the end of the current item display, so that you could add the content there. And we can consider adding trhe content extract in as a display option in the future.

VT vikash tiwary
vikash tiwary
Member

is there any other way to show post content. any manual code which i can use .

any link where i can find something related to it.

please give me. it is very necessary for me.

YS Yellow Swordfish
Yellow Swordfish
Member

There are currently no template tags that will automatically display the post content I am afraid.

VT vikash tiwary
vikash tiwary
Member

ok, np

one other thing i want to show the “Unread and recently updated topics” in to the sidebar widget area.

what we will use for this.

please help,

YS Yellow Swordfish
Yellow Swordfish
Member

There is a widget for this available in the template tags SP plugin.

VT vikash tiwary
vikash tiwary
Member

yes, there is a widget in template tag plugin.

but this is a recent posts widget.

we need the area just like we have now in forum page under the forums “Unread and recently updated topics”.screenshot.png

YS Yellow Swordfish
Yellow Swordfish
Member

Well – fist off I can tell you that the area beneath the group view uses the same sql selection logic – actually uses the same code – as the sidebar widget. They perform the same task except for the fact that the widget is specifically designed and coded to be displayed outside of the forum page.

Does that information make any difference to your thinking or do you want the code to display the list view elsewhere?

VT vikash tiwary
vikash tiwary
Member

if you can give code then it will better for me.

please send me the code.

YS Yellow Swordfish
Yellow Swordfish
Member

Well – bear in mind I have not tried this so at the moment this is largely theory.

If being displayed outside of a forum page then making a call to:

sp_forum_api_support();

should set up the necessary support.

Then calling the actual template function used in the spGroupView.php template would be:

sp_RecentPostList('show=10', 'Unread and recently updated topics');

The ‘show’ argument dictates the maximum number of items to display. The other parameter is the text used above the list.

The following is a list of the possible arguments with their default values, any of which can be overridden in the argument string:

'tagId' => 'spRecentPostList'
'tagClass' => 'spRecentPostSection'
'labelClass' => 'spMessage'
'template' => 'spListView.php'
'show' => 20
'group' => 0
'admins' => 0
'mods' => 1
'get' => 0

As I say – untested but should work I believe.

BR Brandon
Brandon
Member

That does work but there is no CSS styling for the output. If you wanted to match the look that you see in the forum pages you would need to load your SP theme’s CSS style on the page the you use this on.

VT vikash tiwary
vikash tiwary
Member

thanks for this code, its working fine.

can you also tell me where is the spListView.php file exist.

means in which folder i will find it.

i want to customize it to show the post updated date instead of text “3-days ago”

here you can see the screenshot what i am doing.

and just want to replace the post date with the text ” days ago”

recenttopic.png
YS Yellow Swordfish
Yellow Swordfish
Member

It is a template in whatever SP theme you are using. This in turn makes the call to the display function sp_ListLastPost() and you can change the arguments to that for the ‘nicedate’, ‘date’ and, time’. Using ‘nicedate=0&date=1&time=1’ will change it to display the full date and time of the post.

VT vikash tiwary
vikash tiwary
Member

i am using this function

sp_RecentPostList(‘show=10’, ‘Recent Topics’)

and when i am using these arguments in to it

sp_RecentPostList(‘show=10&nicedate=0&date=1&time=1’, ‘Recent Topics’)

it is not changing the date format.

YS Yellow Swordfish
Yellow Swordfish
Member

No – as I said above – all that function does is create the data object and call the template. The display work is performed in the template and you need to change the arguments in the function I named.