Jump to content

Newslink Automatic URL


Kyle F

Recommended Posts

How are you all doing? Hope you're well!

So I have this 'custom' Pages block on my board that basically resembles the old IPB 2.3.x 'newslink' (pic below). I am looking to try and have the latest thread link automatically be placed within the newslink topic as so:

firefox_VGS1vnCzNE.thumb.png.85d42f3e6cf71f025bdb98febab093e3.png

So for example: "domain.com/forums/topic/"   but I want the latest thread in the News & Announcements forum in this newslink automatically. I know it's possible but I don't remember what I need to put into the end of the code for this to happen. 😞 It must automatically show the latest topic name in there with it's link.

I'm sorry I'm not making much sense here, but I don't quite know how to describe it. I know in IPB 2.3.x's 'newslink' the code was as so:

<br /><b>{$this->ipsclass->vars['board_name']} {$this->ipsclass->lang['newslink']}</b> <i><a href="{$this->ipsclass->base_url}showtopic=$tid">$title</a></i>

So what would it be for IPS 4.4.x? (I'm running 4.4.10)

Unfortunately my code is this (it sucks):

  <table class="newslink" cellspacing="0">
	<tbody><tr>
      <td><strong>Last Online:</strong> <em><i></i></em><br /> <strong>Unified Gaming News: </strong> <i><a href="https://unifiedgaming.net/topic/436-counter-strike-source-downtime/"><u>Counter-Strike Source Downtime</u></a></i></td>
		<td valign="middle" align="left">
		
		</td>
	</tr>
</tbody></table>

 

Edited by Kyle F
Link to comment
Share on other sites

16 hours ago, Morrigan said:

I would do a topic feed from your announcements forum and style it like the above. Should be rather simple to do.

Odd. It seems this causes the page not to load or show blank:

  <table class="newslink" cellspacing="0">
	<tbody><tr>
      <td><strong>Last Online:</strong> <em><i></i></em><br /> <strong>Unified Gaming News: </strong> <i><a href="{$topic->url()->setQueryString( 'do', 'getNewComment' )}" title='{lang="view_this_topic" sprintf="$topic->title"}' class='ipsDataItem_title'>{$topic->title}</a></i></td>
		<td valign="middle" align="left">
		
		</td>
	</tr>
</tbody></table>

Specifically:

<a href="{$topic->url()->setQueryString( 'do', 'getNewComment' )}" title='{lang="view_this_topic" sprintf="$topic->title"}' class='ipsDataItem_title'>{$topic->title}</a>

 

Link to comment
Share on other sites

Oh shoot, I didn't realise 4.4.x was all that different... 😅 I did a lot of experimentation for 2 hours but it just kept failing. 😞 I even wrapped the topic feed code in the newslink code but it didn't do good. I don't want all this rubbish in it:

firefox_4QrFqUdssu.thumb.png.61a9fc76db10fd2892c516ee4d8c7bb4.png

So I only want it to show the topic title and link. No "by" or "the member", or the date/time/replies/views, etc. I just want it to look like the screenshot in the first post.

Link to comment
Share on other sites

  • 2 weeks later...

So here is the full code for that block above (the above post):

{{if !empty( $topics ) }}
	<h3 class='ipsWidget_title ipsType_reset'>{$title}</h3>

	{{if $orientation == 'vertical'}}
		<div class='ipsPad_half ipsWidget_inner'>
			<ul class='ipsDataList ipsDataList_reducedSpacing'>
				{{foreach $topics as $topic}}
					<li class='ipsDataItem{{if $topic->unread()}} ipsDataItem_unread{{endif}}{{if $topic->hidden()}} ipsModerated{{endif}}'>
						<div class='ipsDataItem_icon ipsPos_top'>
							{template="userPhoto" group="global" app="core" params="$topic->author(), 'tiny'"}
						</div>
						<div class='ipsDataItem_main cWidgetComments'>
							<div class="ipsCommentCount ipsPos_right {{if ( $topic->posts - 1 ) === 0}}ipsFaded{{endif}}" data-ipsTooltip title='{lang="replies_number" pluralize="$topic->posts - 1"}'>{expression="\IPS\Member::loggedIn()->language()->formatNumber( $topic->posts - 1 )"}</div>
							
							<div class='ipsType_break ipsContained'>
								{{if $topic->mapped('featured') || $topic->hidden() === -1 || $topic->hidden() === 1}}
									{{if $topic->hidden() === -1}}
										<span><span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_warning" data-ipsTooltip title='{$topic->hiddenBlurb()}'><i class='fa fa-eye-slash'></i></span></span>
									{{elseif $topic->hidden() === 1}}
										<span><span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_warning" data-ipsTooltip title='{lang="pending_approval"}'><i class='fa fa-warning'></i></span></span>
									{{endif}}
									{{if $topic->mapped('featured')}}
										<span><span class="ipsBadge ipsBadge_icon ipsBadge_small ipsBadge_positive" data-ipsTooltip title='{lang="featured"}'><i class='fa fa-star'></i></span></span>
									{{endif}}
								{{endif}}							
								<a href="{$topic->url()->setQueryString( 'do', 'getNewComment' )}" title='{lang="view_this_topic" sprintf="$topic->title"}' class='ipsDataItem_title'>{$topic->title}</a>
							</div>
							<p class='ipsType_reset ipsType_medium ipsType_blendLinks ipsContained'>
								<span>{lang="byline_nodate" htmlsprintf="$topic->author()->link()"}</span><br>
								<span class='ipsType_light'>{lang="topic_started_date" htmlsprintf="\IPS\DateTime::ts( $topic->mapped('date') )->html()"}</span>
							</p>
						</div>
					</li>
				{{endforeach}}
			</ul>
		</div>
	{{else}}
		<div class='ipsWidget_inner'>
			<ul class='ipsDataList'>
				{{foreach $topics as $topic}}
					{template="row" group="global" app="forums" location="front" params="NULL, NULL, $topic, FALSE"}
				{{endforeach}}
			</ul>
		</div>
	{{endif}}
{{endif}}

Could someone perhaps do something for me here for a template where the following are removed?:

  • Number of views/replies
  • Name/member
  • "By", date/time and location (forum location)
  • H3 title bar

So it'll look like below:

spacer.png

Link to comment
Share on other sites

Sorry to tell you sugar.... but 3.x is over ten years gone. You'll need a little more than magic to get this back. Send me a DM with what you're willing to spend on it and I'll see if I can for the price. Its not so much difficult as much as it is making it as upgrade proof as possible for you.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...