PDA

View Full Version : trying to make custom page, getting blank page instead


Soliloquy
09-04-2007, 04:38 AM
I'm trying to create a custom page based on this tutorial (https://vborg.vbsupport.ru/showthread.php?t=98009), but am only getting a blank page as a result. What am I doing wrong here?

script:
<?php

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

// ##################### DEFINE IMPORTANT CONSTANTS #######################
// change the line below to the actual filename without ".php" extention.
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation.

define('THIS_SCRIPT', 'thanks_leaderboard');

// #################### 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(
// change the lines below to the list of actual templates used in the script
'thanks_leaderboard',
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ########################## REQUIRE BACK-END ############################
require_once('includes/./global.php');

// #################### HARD CODE JAVASCRIPT PATHS ########################
$headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude);

// ################################################## ######################
// ######################### START MAIN SCRIPT ############################
// ################################################## ######################

$navbits = array();
// change the line below to contain whatever you want to show in the navbar (title of your custom page)
$navbits[$parent] = 'Thanks Leaderboard';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

// change the line below to contain the name of the actual main output template used in your script
eval('print_output("' . fetch_template('thanks_leaderboard') . '");');


?>

template:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions[bbtitle]</title>
</head>
<body>

$header
$navbar

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%"

align="center">
<tr>
<td class="tcat">Thanks Leaderboard</td>
</tr>
<tr>
<td class="alt1">Other Bluff...</td>
</tr>
</table>

$footer
</body>
</html>

Opserty
09-04-2007, 08:43 AM
// pre-cache templates used by all actions
$globaltemplates = array(
// change the lines below to the list of actual templates used in the script
'thanks_leaderboard',
);


Remove the comma after the 'thanks_leaderboard'

Also

// ########################## REQUIRE BACK-END ############################
require_once('includes/./global.php');
Is wrong, did you read the section on "Using vBulletin-powered scripts outside vBulletin Directory" on the tutorial in your original post?
Something like:

$curdir = getcwd();
chdir('path/to/forums/');
require_once('global.php');
chdir($curdir);

Should work.