MyBB Hacks

Full Version: Use a 2nd Portal as a filterable gallery
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I wanted this for so long - I have no idea if anyone else wants it, but as a thank you to ZingaBurga and RateU (without whom this would not exist) I am sharing it here on MYBBHacks.

Assumptions:
You have XThreads installed.
You have one or more forums that are similar in content/use the same sorting filters and you want to present the threads from those forums in one big overview, but NOT on the usual portal page.

1) Download the attached file browse.php and upload it to the forum root.
2) Add the browseportal template to your global templates
3) Apply the portal announcement layout to the forums you want to show in the browse. Warning - as this is a totally different template do not show these forums in your standard portal announcements.

Template name: browseportal
Location: Global templates

HTML Code
<html>
<head>
<title>{$mybb->settings['bbname']} - Downloads</title>
{$headerinclude}
<style type="text/css">
#container{width:1000px;margin:auto auto;}
.swordfish {height:140px;padding:1px;max-height:120px}
.filterfish {float:left; height: 525px; padding: 3px; max-height: 525px;}
</style>
</head>
<body>
{$header}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">	
<tr>
		<td class="thead" colspan="{$colspan}" align="center">
				<strong>The Big List of Everything</strong>
		</td>
</tr>
<tr>
<td  align="center" valign="top">
<div class="float_left">
<div class="filterfish" align="left">
	<table class="trow1" style="border: 1px solid;min-height:523px;width:190px;">
		<tbody style="clear:both;">
			   	<tr><td class="tcat"><strong>Filters</strong></td></tr>
			   	<tr><td class="trow1"><a href="browse.php?"><span><strong>View all Downloads</strong></span></a></td></tr>
				<tr><td class="trow1 {$filters_set['prefix']['active']['Prefix 1']}"><a href="browse.php?&amp;filtertf_prefix=Prefix 1"><strong>View only Prefix 1</strong></a></td></tr>
				<tr><td class="trow1 {$filters_set['prefix']['active']['Prefix 2']}"><a href="browse.php?&amp;filtertf_prefix=Prefix 2"><strong>View only Prefix 2</strong></a></td></tr>
		</tbody>
		<tbody>
		<tr>
		<td align="center">
		<div class="swordfish; smalltext" style="margin-top:20px;">
		<img src="http://i52.tinypic.com/ekf8eu.gif" /></div>
		<br />
		</td>
		</tr>
		</tbody>
		<tbody>
		<tr>
		<td valign="top" style="margin-top: 5px; max-height: 45px; min-height: 45px;">
		<strong><a href="{$mybb->settings['bburl']}/showthread.php?tid={$announcement['tid']}">{$announcement['subject']}</a></strong>
		</td>
		</tr>
		</tbody>
	</table>
</div>


Template name: forum_portal_announcement
Location: Global templates

* forum_portal_announcement where "forum" is your template prefix. Eg, if you have a forum with XThreads templates with the prefix woot then you would call this template woot_portal_announcement

HTML Code
<div style="float:left; height: 260px; padding: 3px; max-height: 260px;" align="center">
	<table class="trow2" style="border: 1px solid;width:190px; height:258px;">
		<tbody>
		<tr>
		<td valign="top">
		<div style="clear:both;">
		<div style="float:left; margin-top:1px;">{$GLOBALS['threadfields']['prefix']}</div>
		<div class="smalltext" style="margin-top:1px;">Uploader: <a href="{$mybb->settings['bburl']}/member.php?action=profile&amp;uid={$announcement['uid']}">{$announcement['username']}</a></div>
		</div>
		</td>
		</tr>
		</tbody>
		<tbody>
		<tr>
		<td align="center">
		<div class="swordfish; smalltext" style="margin-top:20px;">
{$message}
<br />

</div>
		</td>
		</tr>
		</tbody>
		<tbody>
		<tr>
		<td valign="top" style="margin-top: 5px; height: 45px; min-height: 45px;">
		<strong><a href="{$mybb->settings['bburl']}/showthread.php?tid={$announcement['tid']}">{$announcement['subject']}</a></strong>
		</td>
		</tr>
		</tbody>
	</table>
</div>


A guide on how to make the custom thread field for the prefixes is here:

http://mybbhacks.zingaburga.com/showthread.php?tid=291

Customising the browse.php to your needs:

on lines 48 - 50 of the php file there are these settings:

PHP Code:
add_breadcrumb("Downloads", $mybb->settings['bburl']."/browse.php");

$mybb->settings['portal_announcementsfid'] = '16, 7,14,22,29,53,55,73,78';
$mybb->settings['portal_numannouncements'] = '13';


The add breadcrumb can be changed to whatever you want your page to be called.

The portal_announcementsfid is the list of forums you are adding - yea , I have a lot Smile
The portal_numannouncements is the number of boxes you wish to show per page.

You can show a picture instead of the message but you need to have an XThreads picture in the post.

You can set up an image field following this :
http://mybbhacks.zingaburga.com/showthread.php?tid=531 .


The articles layout in combination with this layout I am sharing here would make a pretty good news page I think. HINT.

If you want to see it in action on leefish here is the link:  http://www.leefish.nl/mybb/browse.php

Thanks for sharing.
I might note that the filtering needs to somewhat also assume that each forum included in the portal has the filtered thread field enabled for them, otherwise the results may be a little unpredictable in some edge cases.
Thanks Zinga - yes, it was very specific for my needs, but I think that there are more possibilities for this than the gallery I made. And yes, you are right -  the filters need to "match" - but I built my whole setup wanting this in the end, so I made sure that all forums I wanted to "report" on were pretty much identical as far as filtering is concerned.

Finally, thanks to you and RateU I have what I wanted:

* manageable layouts
* good file management
* specific forums per uploader
* a stats page for uploaders
* graphical representation of downloads of an uploaders items

and now this, the Big List of Everything,  the jewel in my downloads system crown.  Smile
Thanks for sharing, Lee Smile
amazing idea - Thanks leefish Smile
Reference URL's