View Full Version : Adding the latest threads block as a separate page.
Nocturnal222
06-20-2017, 07:40 AM
Hello
I'm not sure how to explain best what I am trying to do, but I'll try to be clear.
I am currently running a game server. I host my community and post my updates on my vBulletin forums. To keep the players up to date, I have to manually add the news to my launcher page via FTP, which I sometimes forget to do.
On the forums, I use the default "Latest Threads" block set to my News & Information section to have a news stream. Is there a way I can re-create that block with it's whole code on a new page, and place that as my game-launcher page? I don't want the header, navbar and so on present in the launcher, as the window size is pretty constrictive. Just the news feed.
The idea is that when I post a news thread on my forum, it will be automatically displayed(on the next block refresh) in the game launcher.
Any help is appreciated.
grey_goose
06-20-2017, 03:56 PM
This is an excellent resource for creating custom/new pages:
https://vborg.vbsupport.ru/showthread.php?t=228112
You'd then need to do a plugin query (https://www.vbulletin.com/docs/html/main/codestandards_sql_query) and register it for use in a template:
https://vborg.vbsupport.ru/showthread.php?t=228078
You learn what's in those two links, and you can do darn near anything.
Nocturnal222
06-21-2017, 08:12 AM
I've managed to create the page fine using those guides, and it displays as per the template, but what would I need to place(and where) in order to get this (https://puu.sh/wqiB5.png) to display instead of this (https://puu.sh/wqiA4.png).
I'm currently running everything in the default style until I figure it out.
I essentially want to link the new page I've created to someone and all they would see is the latest new threads in a few sections I've nominated, much like I currently have the sideblock setup.
Keep in mind that this is for external users, who play the game server I am hosting, but aren't really the forum type. To view the page, it should not require a login. I will also be removing the header and footer so the announcement page is straight to the point, as the display window I am working with is rather small(and cannot be resized) so adding headers+ extra stuff will simply push the information down.
grey_goose
06-21-2017, 10:00 PM
You'll need to write a query (see second link) and register it for use in that template. If you're not familiar with SQL queries, then you're probably best off just finding a mod like this (https://vborg.vbsupport.ru/showthread.php?t=233759).
MarkFL
06-21-2017, 11:27 PM
I've managed to create the page fine using those guides, and it displays as per the template, but what would I need to place(and where) in order to get this (https://puu.sh/wqiB5.png) to display instead of this (https://puu.sh/wqiA4.png).
I'm currently running everything in the default style until I figure it out.
I essentially want to link the new page I've created to someone and all they would see is the latest new threads in a few sections I've nominated, much like I currently have the sideblock setup.
Keep in mind that this is for external users, who play the game server I am hosting, but aren't really the forum type. To view the page, it should not require a login. I will also be removing the header and footer so the announcement page is straight to the point, as the display window I am working with is rather small(and cannot be resized) so adding headers+ extra stuff will simply push the information down.
If you'll post the content of your external script, I'll add the necessary query to it, along with a threadbit template and product settings so you can control how many latest threads are displayed, and which forum(s) they are selected from, and any other settings you want. :)
Nocturnal222
06-22-2017, 09:51 AM
You'll need to write a query (see second link) and register it for use in that template. If you're not familiar with SQL queries, then you're probably best off just finding a mod like this (https://vborg.vbsupport.ru/showthread.php?t=233759).
That modification is basically what I'm trying to do, but I need it to be lightweight. The launcher is pretty ancient and I'm not sure how well it would handle such a news feed.
Mark, if you are referring to the content of my .php file, it is as Lynne suggested for a start.
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'rmulauncher');
define('CSRF_PROTECTION', true);
// change this depending on your filename
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array('rmulauncher',
);
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
// if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line
// chdir ('/path/to/your/forums');
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
$navbits = construct_navbits(array('' => 'Rise News'));
$navbar = render_navbar_template($navbits);
// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'Rise News';
// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######
$templater = vB_Template::create('rmulauncher');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());
?>
I'm not very familiar with scripts, so this is basically what I need help with right now till I get my head around it a bit more. Someone else had been doing this for me up until recently.
The script I'm using for this block (https://puu.sh/wqiB5.png) is the default vBulletin 4 Latest Threads script.
MarkFL
06-22-2017, 01:41 PM
Okay, I will put everything together tonight and post the end result when I'm done. :)
edit: Unfortunately, an issue has come up that I must address immediately, and so there will be a delay on this. I do apologize for the inconvenience, but the delay shouldn't be more than a day or two.
Nocturnal222
06-23-2017, 03:20 AM
That's fine. I'm getting someone helping me out, I can't be picky about it as well. :P
I've been doing it manually for years now, a few days won't hurt me.
MarkFL
06-23-2017, 03:40 AM
That's fine. I'm getting someone helping me out, I can't be picky about it as well. :P
I've been doing it manually for years now, a few days won't hurt me.
I'm actually working on it now. I expect to have something for you tomorrow. :)
MarkFL
06-23-2017, 03:50 PM
Okay, I have attached a preliminary product for you to test out, and let me know if there are any issues or features you want added. :)
Nocturnal222
06-24-2017, 02:29 AM
This is exactly what I needed, and more than I had hoped for! Thank you very much!
MarkFL
06-24-2017, 02:42 AM
This is exactly what I needed, and more than I had hoped for! Thank you very much!
Glad to help! :)
MarkFL
06-25-2017, 02:42 AM
In my haste, I neglected to include the thread prefixes and icons in the threadbit template. I have attached the updated .XML file, and there's no need to update the .PHP file as it already included the code to grab those. :)
Sorry for the inconvenience.
CAG CheechDogg
06-26-2017, 09:52 PM
Mark ... there is one little glitch I found in the styling ...
When there is a smaller avatar especially the height ...the date stamp floats all the way to the left below the avatar ...
This is the change I made to give a little more style to the "rmulauncher_threadbit" template ....
<div style="padding: 5px; height:45px; border-bottom: dotted 1px #CCCCCC;">
<div style="float: left; margin-right: 75px; width: 40px;">
<img src="{vb:raw recent_thread.avatar}" style="max-height: 40px; margin-left: 25px;" />
</div>
<a style="font-weight: bold;" href="{vb:raw recent_thread.thread_url}">{vb:raw recent_thread.title}</a>
<div>
{vb:rawphrase posted_by} <a href="{vb:link member, {vb:raw recent_thread}, null, 'postuserid', 'postusername'}" class="username understate">{vb:raw recent_thread.postmusername}</a> ({vb:raw recent_thread.replycount} {vb:rawphrase replies})
</div>
<div style="float: right; margin-left:100 px; margin-top:-15px;">{vb:raw recent_thread.timestamp} in <a href="{vb:raw recent_thread.forum_url}">{vb:raw recent_thread.forumtitle}</a></div>
</div>
MarkFL
06-26-2017, 10:00 PM
I actually intended to add more features/styling to the page, but the OP seemed happy, so I left it as is. :)
CAG CheechDogg
06-27-2017, 04:03 AM
Add more ... add more ... add more !!!! https://vborg.vbsupport.ru/external/2017/06/1.gif
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.