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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,231
  • Total Topics: 21,353
  • Online today: 515
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 118
  • Total: 119
  • lurkalot

Scrolling Recent Topic In Top Panel with SMF 2.04

Started by DukeOfAwesome, July 10, 2013, 03:09:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DukeOfAwesome

Hi,

I am using SMF 2.04 with Tiny Portal. One thing I am having difficulty with is implementing the scrolling topics into the top panel. After reading through the scrolling topics thread on this site, there are a couple of issues with it:

- It doesn't scroll
- All the Topics are squeezed to the left hand side of the panel. This is instead of having each topic on a distinct line like:
      <Topic Title>  <Topic Poster>  <Date Time>
It looks like:
      <Topic Title> 
     <Topic Poster> 
<Date Time>

- I have tried to use the option of Classic Recent Topics but that doesn't seem to work with 2.04 because not only is it squeezed into the left hand side of the panel, it also doesn't bring across the users avatar and leaves a square box with a red X denoting a missing image.

I thought I would start a new thread on this subject in the hope of getting a definitive answer on using this with SMF 2.04.

Many thanks with any help you can provide.

Duke

ZarPrime

Please read my post here and do as I asked you to before --> http://www.tinyportal.net/index.php?topic=31639.msg281034#msg281034

We need to see your site to see what it looks like and we need a link to the topic here containing the block code that you are trying to use so that we can try to sort this out for you.  This is the only way that we can try to assist you.  Help us to help you.  Otherwise, we wil have no choice but to ignore your request.

ZarPrime

DukeOfAwesome

Hi Zarprime,

Sorry, here is the info you need:

Link to my forum: http://www.carltonsc.com/index.php?action=forum
SMF version: 2.04
TP version: 1.0
Default Forum Language: English
Theme name and version: Elegant
Browser Name and Version: Firefox 22.0
Mods installed: Tiny Portal
Related Error messages: None

Duke

IchBin

You still haven't given a link to the code you are using so we can see/use/test the same code you are trying to use. We need to see the topic you are talking about.

DukeOfAwesome

Quote from: IchBin™ on July 10, 2013, 09:20:33 PM
You still haven't given a link to the code you are using so we can see/use/test the same code you are trying to use. We need to see the topic you are talking about.

I am just using the Classic Recent Topics Written by Bloc code that comes standard with TinyPortal. I tried all the hacks that were in the other scrolling thread here on this site, but none worked. The code below does show the recent topics, but as explained earlier squeezes all the topics into the left hand side.

The other scrolling thread is here: http://www.simplemachines.org/community/index.php?topic=13985.0

global $context, $modSettings, $txt;
$context['TPortal']['recentboxnum'] = '15';

if(isset($modSettings['recycle_board']))
$bb = $modSettings['recycle_board'];

$what = ssi_recentTopics($context['TPortal']['recentboxnum'], NULL, NULL, 'array');
$counter=1;
$cmax = count($what);

echo '
<div style="width: 100%; overflow: auto; height: 30ex;">';

foreach($what as $w)
{
echo '
<div class="smalltext"><a href="'.$w['href'].'">' . $w['short_subject'] . '</a></div>
<div class="smalltext">', $txt['by'], ' <b>', $w['poster']['link'], '</b></div>
<div class="smalltext">';
if(!$w['new'])
echo '<a href="'.$w['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';

echo '['.$w['time'].']
</div>';

if($counter != $cmax)
echo '<hr />';
$counter++;
}
echo '
</div>';

IchBin

TP's default recent topics code was never meant to scroll. And it will not scroll unless you edit the TP files that contain the recent posts code.

The only thing you need for the code to scroll is a <marquee> tag surrounding the recent posts. If the layout isn't how you want it, then just change the HTML to be what you need. Can't really read your mind here on exactly how you want things to appear.

DukeOfAwesome

Quote from: IchBin™ on July 11, 2013, 07:09:28 AM
TP's default recent topics code was never meant to scroll. And it will not scroll unless you edit the TP files that contain the recent posts code.

That is what I am asking, which files and how do I go about creating this feature. This is my first time using TP and SMF so need guidance.

Quote from: IchBin™ on July 11, 2013, 07:09:28 AMThe only thing you need for the code to scroll is a <marquee> tag surrounding the recent posts. If the layout isn't how you want it, then just change the HTML to be what you need. Can't really read your mind here on exactly how you want things to appear.

I realise you need to use the marquee tags, but where exactly should they be placed and which files need to be modified?

The way I would like to have it appear is like our old PHPBB site which can be viewed here:

http://archive.carltonsc.com/modules.php?name=Forums

Is there a way to achieve that?

Thanks

Duke

IchBin

In the Themes/default/TPsubs.template.php file there should be a function called TPortal_recentbox() I think. That is the code that creates the recent topic block. Just add your marquee tag right where the html starts, and close the marquee tag where the html ends. Basically all the HTML needs to be surrounded by the marquee tag.

DukeOfAwesome

Just for future reference for anyone else wanting to do this, here is the code that works and is compatible with SMF 2.04:

function TPortal_recentbox()
{
global $scripturl, $context, $settings, $txt, $modSettings;

    // is it a number?
if(!is_numeric($context['TPortal']['recentboxnum']))
$context['TPortal']['recentboxnum']='10';

// leave out the recycle board, if any
if(isset($modSettings['recycle_board']))
$bb = array($modSettings['recycle_board']);
else
$bb = array();

if($context['TPortal']['useavatar'] == 0)
{
$what = ssi_recentTopics($context['TPortal']['recentboxnum'], $bb, 'array');

// Output the topics

echo ' <marquee  behavior="scroll" direction="up" height="300" scrolldelay="10" scrollamount="2" onmouseover="this.stop()" onmouseout="this.start()">
<ul class="recent_topics" style="' , isset($context['TPortal']['recentboxscroll']) && $context['TPortal']['recentboxscroll'] == 1 ? 'overflow: auto; height: 20ex;' : '' , 'margin: 0; padding: 0;">';
$coun = 1;
foreach($what as $wi => $w)
{
echo '
<li' , $coun<count($what) ? '' : ' style="border: none; margin-bottom: 0;padding-bottom: 0;"'  , '>
<a href="' . $w['href'] . '" title="' . $w['subject'] . '">' . $w['short_subject'] . '</a>
', $txt['by'], ' <b>', $w['poster']['link'],'</b> ';
if(!$w['new'])
echo ' <a href="'.$w['href'].'"><img src="'. $settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';

echo '<br /><span class="smalltext">['.$w['time'].']</span>
</li></marquee>';
$coun++;
}
echo '
</ul></marquee>';
}
else
{
$what = tp_recentTopics($context['TPortal']['recentboxnum'], $bb, 'array');

// Output the topics
$coun = 1;
echo '<marquee  behavior="scroll" direction="up" height="300" scrolldelay="10" scrollamount="2" onmouseover="this.stop()" onmouseout="this.start()">

<ul class="recent_topics" style="' , isset($context['TPortal']['recentboxscroll']) && $context['TPortal']['recentboxscroll']==1 ? 'overflow: auto; height: 20ex;' : '' , 'margin: 0; padding: 0;">';
foreach($what as $wi => $w)
{
echo '
<li' , $coun<count($what) ? '' : ' style="border: none; margin-bottom: 0;padding-bottom: 0;"'  , '>
<span class="tpavatar"><a href="' . $scripturl. '?action=profile;u=' . $w['poster']['id'] . '">' , empty($w['poster']['avatar']) ? '<img src="' . $settings['tp_images_url'] . '/TPguest.png" alt="" />' : $w['poster']['avatar'] , '</a></span><a href="'.$w['href'].'">' . $w['short_subject'].'</a>
', $txt['by'], ' <b>', $w['poster']['link'],'</b> ';
if(!$w['new'])
echo ' <a href="'.$w['href'].'"><img src="'. $settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';

echo '<br /><span class="smalltext">['.$w['time'].']</span>
</li>';
$coun++;
}
echo '
</ul></marquee>';
}
}

IchBin


This website is proudly hosted on Crocweb Cloud Website Hosting.