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,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 445
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 415
  • Total: 415

Recent Topics module ?

Started by hashend94, October 25, 2012, 07:06:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ZarPrime

Oh, yeah Freddy.  That's some nice code there.  That's why you are the Master Coder and I am just the troubleshooter. ;) That would work perfectly if he wants each tab to only contain the recent topics from one board.  I was thinking that he might want multiple boards for each tab though.  That's why I posted that little code snippet in my last post so that the array for the included boards would be picked up by a single tab.  However, I'm still not certain exactly what he wants in each tab so your way may be the right way to do it, one board per tab.  You see what I mean?

ZarPrime

Freddy

#21
Yep I see exactly what you mean and your method will fit in fine if I am reading ssi.php right...

If he wants a couple of boards in the same tab, he should simply be able to do this :


        // Tab 1
mot_NewTopics(array(1,12,16));

// Tab 2
mot_NewTopics(2);

// Tab 3
mot_NewTopics(array(13,29));


And so on....we are on the same page  :)

ZarPrime

Cool !!!  Yeah, that would probably work just fine.  Unfortunately, I don't have time to check that out right now.  Saturday is always a busy day for me. ::) I saw hashend94 on here a couple of minutes ago so maybe he'll log again in a bit and try this out and let us know what happens.  If that works for him, we can split these posts out and merge them back into the block code topic as an alternative for "all tabs contain topics from specific boards" or something like that. O0

ZarPrime

Freddy

Sounds good.  I just tested it and it's working fine here...two boards in one tab...one board in another etc...

O0

Freddy

Just dropping some images in for reference as I don't have a live demo of this anymore.

ZarPrime

OK, excellent. 8) I figured it would work fine.  I'll do some rearranging of posts here later on this evening, or maybe tomorrow.  Nice job on this Freddy !!! ;)

ZarPrime

hashend94

Hey guy! Sorry for the late reply, I tried and it works fine! Thankyou very much for the support :) Really appreciate it !

hashend94

And also one more question. Is it possible to add the time when the thread was used (last used )

ZarPrime

Hmmm.  Well, try this code for the php file instead.  It might work.  If not, let us know and Freddy will have to take a look at it again, or you can let me know what happens and I'll try to troubleshoot it.

ZarPrime
Code follows below ...


<?php
// ===============================================================================================
// mouseoverTabContent.php - very simple version to just show recent topics from certain boards.
// 03 November 2012
//
// Code is based on the work of StormLrd and modifications by dimdom.
// This file pulls together their work and has been assembled by Freddy888.
//
// This file is designed to pull data from an SMF forum and put it in a Tiny Portal tabbed block.
// This uses a  modified version of the 'Mouseover Tabs Menu' at 
// http://www.dynamicdrive.com/dynamicindex1/mouseovertabs.htm
//
// Functions are prefixed 'mot_' meaning 'mouse over tab'.
// Basically each function equals one tab contents in your Tiny Portal block code.
// The order in which the functions are called is the order the tabs will appear in.
// You can put whatever you like in these functions or add more,
// this method just makes it easier to move stuff around.
//
// The actual 'output' from this file occurs at the end of this file.
// You can skip down to the bottom to fine tune things...
//
// Functions in this version :
// mot_NewTopics(BOARD-ID)
// ===============================================================================================



// ****************
// INITIALISATION..
// ****************


// The mouseover tabs JS code generates a $_GET we don't need at this point it seems.
// We need to empty the $_GET variable here otherwise SMF throws a 'Invalid request variable'.
// See circa line 99 in QueryString.php for more info. 888
$_GET = array();

// Going to need all the useful things in SSI.
require_once('../SSI.php');

// Initialise Tiny Portal.
TPortal_init();

// Work out where all the TP images are....
$tpimagesurl $boardurl '/Themes/default/images/tinyportal';
$tpimg['options'] = $tpimagesurl '/TPoptions.gif';
$tpimg['bullet4'] = '<img src="' $tpimagesurl '/TPgoto.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$tpimg['tpblue'] = $tpimagesurl '/TPblue.gif';
$tpimg['bullet1'] = '<img src="'$tpimagesurl '/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$tpimg['bullet2'] = '<img src="'$tpimagesurl '/TPdivider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$tpimg['bullet3'] = '<img src="' $tpimagesurl '/TPdivider3.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
$tpimg['article'] = $tpimagesurl '/TParticle.gif';




// *************
// The Functions
// *************



// Grabs recent topics in a particular board...
function mot_NewTopics($boardid)
{
global $scripturl$settings$context$txt;

$what ssi_recentTopics('5'NULL$boardid'array');

echo '
<div class="tabsmenucontent" style="padding: 5px">
<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
<tr class="catbg3">
<td valign="middle">Topic</td>
<td valign="middle">Board</td>
<td valign="middle">Writer</td>
<td valign="middle">Date & Time</td>
<td valign="middle"></td>
</tr>'
;

foreach ($what as $topic)
{
echo '
<tr>
<td class="windowbg" valign="middle">'
$topic['link'];

// Is this topic new? (assuming they are logged in!)
if (!$topic['new'] && $context['user']['is_logged'])
echo '
<a href="'
$scripturl'?topic='$topic['topic'], '.from'$topic['time'], '#new"><img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="new" border="0" /></a>';

echo '
</td>
<td class="windowbg2" valign="middle">'
$topic['board']['link'], '</td>
<td class="windowbg2" valign="middle">'
$topic['poster']['link'], '</td>
<td class="windowbg2" valign="middle">'
$topic['time']['link'], '</td>
<td class="windowbg2" valign="middle">'
;

if ($settings['images_url'] != $settings['theme_url'] . '/images' || file_exists($settings['theme_dir'] . '/images/icons/last_post.gif'))
echo '
<a href="'
$topic['href'], '"><img src="'$settings['images_url'], '/icons/last_post.gif" alt="Last Post" title="Last Post" border="0" style="float: right;" /></a>';
}

echo 
'
</td>
</tr>
</table>
</div>'
;
}


/*
// An example function...don't forget to call it in the config at the bottom!

function mot_myFunction()
{
global $what $ever $you $need $here;

echo '
<div class="tabsmenucontent" style="padding: 5px">'

// All your code goes here...

echo '
</div>';
}
*/




// *************************************
// And finally output & configuration...
// *************************************

echo '
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>'
;

// Tab 1
mot_NewTopics(1);

// Tab 2
mot_NewTopics(2);

// Tab 3
mot_NewTopics(3);

echo '
</body>
</html>
'
;
?>


hashend94

Hey guys, sorry for bumping this thread after a very long time. But I was just wondering does this work on other portals systems ? I know this rude :S But I just wanted to know. Sorry If I offend any of you >___<

This website is proudly hosted on Crocweb Cloud Website Hosting.