Add category link to SP article post

by Mick in Tutorials on 20 Mar 2013



The one thing SimplePortal forgot to do was the need to show where this article was posted in your category list next to the time posted and the author's name. We're going to use the simple code below and add it to the PortalArticles.template.php to get the effect we want.

', $txt['postedin'], ' ', $article['board']['link'], '

Instead of looking like this:
Mick ? 1 hour ago ? 0 Comments

Will look like this:
Mick ? Posted in Scripts & Tuts ? 1 hour ago ? 0 Comments



In Themes/default/PortalArticles.template.php

Find:
echo '
<div class="middletext">', $article['message']['time'], ' ', $txt['by'], ' ', $article['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $article['topic']['views'], ' | ', $txt['sp-articlesComments'], ': ', $article['topic']['replies'], '</div>';


Replace with:
echo '
<div class="middletext">', $txt['postedin'], ' ', $article['board']['link'], ' ', $article['message']['time'], ' ', $txt['by'], ' ', $article['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $article['topic']['views'], ' | ', $txt['sp-articlesComments'], ': ', $article['topic']['replies'], '</div>';



In Themes/default/languages/index.english.php
At the very end add:
$txt['postedin'] = 'Posted in';
Mick is an American theme designer for Simple Machines Forum software currently living in South Florida, USA. He runs idesignSMF and started tinkering with SMF in 2006 where he created several SMF forums of his own before he founded idesignSMF in 2009 to which he is dedicated full time.
    
0 Comments

Get more stuff like this

Subscribe to our mailing list and get interesting content and updates.