TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 18, 2024, 05:41:20 AM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,164
  • Total Topics: 21,219
  • Online today: 190
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 83
  • Total: 84
  • @rjen

Recent Topics from a single board to show in a block on frontpage?

Started by VladTepes, March 29, 2017, 02:05:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

VladTepes

Hi,  I would like for recent posts in one of my forum boards (it's titled Announcements" to be shown in a block on the front page  (i.e. Home from the top menu)

So far I have tried a recent topics block, but I can't restrict it to a single board.

I have also tried in frontpage settings near the bottom and selected "Announcements' in the Display forum-posts on frontpage from: section.
I've tried this in combination with the What to display on frontpage: set as "selected topics only" and as "frontpanel" but no joy.

I'd very much appreciate if someone could point me in the right direction with this.  Thanks

lurkalot

You could use that rss script I linked to in that other thread to grab and display those, otherwise we could see if there's another solution. perhaps using ssi_boardNews etc.

Just change the site address and the board number in the code below, and add it to that rss script.
http://whatevermysitescalled.com/index.php?action=.xml;board=73;type=rss'

VladTepes

Thanks, I tried, doing what I think you intended me to do, but it's not displaying.
Perhaps you;d be kind enough to check my code for me?

$rss = new DOMDocument();
$rss->load('http://gsx1400owners.org/forum/index.php?action=.xml;board=22.0;type=rss');
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
);
array_push($feed, $item);
}
$limit = 5;
for($x=0;$x<$limit;$x++) {
$title = str_replace(' & ', ' & ', $feed[$x]['title']);
$link = $feed[$x]['link'];
$description = $feed[$x]['desc'];
$date = date('l F d, Y', strtotime($feed[$x]['date']));
echo '<p><strong><a href="'.$link.'" title="'.$title.'">'.$title.'</a></strong><br />';
echo '<small><em>Posted on '.$date.'</em></small></p>';
echo '<p>'.$description.'</p>';
}


I get
Quote


Posted on Thursday January 01, 1970


Posted on Thursday January 01, 1970


Posted on Thursday January 01, 1970


Posted on Thursday January 01, 1970


Posted on Thursday January 01, 1970
And that's all - posted dates (all of which as you can see are wrong/some kind of default date) and no actual content.....

lurkalot

Mike, you trying this on your local testbed? or your live site?  Reason I ask is your live site forum isn't viewable to guests at all so your rss link won't work.  ;)

The code itself works fine for me though, can pull content from my guitarist site, and from a board on smf.org without problems. http://cctestsite.info/forums/index.php

VladTepes

Live site.  Ah well, yes that would be it then.

I wanted to stop guest browsing because I want them to have a reason to register !

I didn't know RSS was dependant on that - I thought you could generate a feed and display it in the same site no worries - but evidently not eh.

Alright well if this can't be done via RSS what other method is there.
I know when I previously had EZPortal installed there was an EZPortal block which accomplished exactly this... Anything posted in announcement forum went to the block and the block settings allowed a character count to be specified....


Lastly - when I look in the forum - there is a "promote to frontpage" link on posts.  Can you explain the function of this tome please?  This might be precisely what I need if it allows me to control specifically what posts end up in the front page in a block...

Thanks

VladTepes

Further to the above, I have tried the "promote to frontpage" option for a topic.  It initially didn't work until I went and ticked the

What to display on frontpage:  Selected topics only

I was worried that this would disable the blocks I have in the frontpanel.  But then I found the option to display it before, or after 'content'

So this is OK except that to get the look I really want I need the following structure
QuoteBlock 1 (bbcode)
Content (promoted posts)
Block 2 (gallery block)

in that order...

The ideal way to accomplish this, I imagine, would be to have a block into which the 'promote to frontpage' material ends up.

I'm open to any solutions you can suggest.

Thanks

lurkalot

Quote from: VladTepes on March 31, 2017, 01:27:23 AM

I wanted to stop guest browsing because I want them to have a reason to register !



Not generally thought of as a good idea. If it's a private club type of thing then that's fine because they know what to expect. It won't encourage outsiders, and your content won't get indexed by google etc either. 

Quote from: VladTepes on March 31, 2017, 01:27:23 AM


Alright well if this can't be done via RSS what other method is there.
I know when I previously had EZPortal installed there was an EZPortal block which accomplished exactly this... Anything posted in announcement forum went to the block and the block settings allowed a character count to be specified....



I'll try and touch on this next bit more later, have to go work for a few hours.  :(

But when you were using EZPortal your forum was visible to guests. Anything that can't be seen by guests won't be seen in a portal block either.  Not in any portal.

By the way I did register on there so I could see what was happening with the ess stuff, but need approval.

VladTepes

sent you a PM re registration mate.

Not sure what happened but spoke with my other admins and they think put it back to so guests can view. That will presumably fix the RSS issue.

I'm thinking the promote to frontpage thing might work even better for us, if we can get the positioning issues right.

Thanks