Portal NEWS widget - show the last message
3 posters
Page 1 of 1
Portal NEWS widget - show the last message
Technical Details
Forum version : #phpBB2
Position : Founder
Concerned browser(s) : Google Chrome
Who the problem concerns : Yourself
Forum link : ( link is hidden, you must reply to see )
Description of problem
Hey guys!I was looking into making a proper news widget to feature the news topic. So it should show the latest message in the topic.
The already suggested by Forumotions widget "NEWS" unfortunately only shows the first message of the topic. (even if the topic has Sort the posts of a topic by : by post date most recent first enabled) any idea if this can be changed?
Also, NEWS widget specifies only selected forum, you cannot choose to always show one selected topic.
Is it possible to show the last message of the selected topic using a script then? Would this work with NEWS widget or a separate widget will have to be created?
Re: Portal NEWS widget - show the last message
Hi,
So you have a topic and you want to show to last post in it in a widget, right? If so, then it's possible and actually pretty easy to do. Let me know if that's what you want.
So you have a topic and you want to show to last post in it in a widget, right? If so, then it's possible and actually pretty easy to do. Let me know if that's what you want.
Guest- Guest
Re: Portal NEWS widget - show the last message
Yes, exactly that.
Haha, apologies for my convoluted explanation.
Haha, apologies for my convoluted explanation.
Re: Portal NEWS widget - show the last message
PM me an account on your forum(member, not mod or anything else).
Guest- Guest
Re: Portal NEWS widget - show the last message
Sent. Let me know if you will get lost or don't understand something
Page translate should help, tho.
Page translate should help, tho.
Re: Portal NEWS widget - show the last message
Add this script with placement on all pages:
3587 is the topic id.
Place this HTML code where you want the post to load:
- Code:
$(function(){
var forum=3587;
var elem=$(".news_forum");
if(!elem.length) return;
$.get("/t"+forum+"-?view=newest", function(data){
data=$(".postbodyinside", data).last().html();
elem.html(data);
})
})
|
Place this HTML code where you want the post to load:
- Code:
<div class="news_forum">Loading...</div>
Guest- Guest
Re: Portal NEWS widget - show the last message
The topic ID would be for example: 153567? (this topic)
Re: Portal NEWS widget - show the last message
Oh wow. Amazing!
Had to put it in
tho.
One more thing, how to get the posters name? If possible.
Had to put it in
|
One more thing, how to get the posters name? If possible.
Re: Portal NEWS widget - show the last message
Do you mean the author of the post?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Portal NEWS widget - show the last message
Yes. Not the topic author, but the referred post author.
Re: Portal NEWS widget - show the last message
this should do it but not sure what elements are for phpBB2
- Code:
$(function(){
var forum=3587;
var elem=$(".news_forum");
var elem2=$(".news_user");
if(!elem.length) return;
$.get("/t"+forum+"-?view=newest", function(data){
var data2;
data=$(".postbodyinside", data).last().html();
data2=$(".postprofile > dl > dt > strong", data).last().html();
elem.html(data);
elem2.html(data2);
})
})
Similar topics
» News Widget
» the last message in the "News" widget shown
» Display news from multiple forums on the portal?
» signature doesn't appear on portal when posting a news
» News Widget Issue
» the last message in the "News" widget shown
» Display news from multiple forums on the portal?
» signature doesn't appear on portal when posting a news
» News Widget Issue
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum