PDA

View Full Version : Need help with a little custom page


dezkit
02-03-2013, 07:50 PM
So far I have

{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
<title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
{vb:raw headinclude}
{vb:raw headinclude_bottom}
</head>
<body>

{vb:raw header}

{vb:raw navbar}

<div id="pagetitle">
<h1>{vb:raw pagetitle}</h1>
</div>

{vb:raw results}

<vb:each from="results" value="result">
{vb:raw result.title}
</vb:each>

{vb:raw footer}
</body>
</html>

and

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################

define('THIS_SCRIPT', 'events');
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('evens',
);

// 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('' => 'Events'));
$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'Events';

$results = $db->query_read('SELECT * FROM ' . TABLE_PREFIX . 'thread WHERE forumid=26 ORDER BY dateline DESC');


// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######

$templater = vB_Template::create('events');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('results', $results);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());

?>

There is no output. Anybody know why?

Also I would like to know if there are already any pre-existing custom pages that grab all threads from a certain forum. Thank you :-)

--------------- Added 1359938180 at 1359938180 ---------------

bump :)

Lynne
02-04-2013, 03:55 AM
When you say there are no results, do you mean a blank page or just a header, footer, and nothing inbetween? You have run a query, but all you have are pointers to the results. You need to complete your query with a while/fetch_array or similar. I'd suggest reading up on mysql queries.