PDA

View Full Version : Need Static Template help....... bad


Mavs00
09-16-2005, 08:45 PM
First, I'm a code dummy.......

I've been attempting to follow this seemingly simple -TEMPLATE- (https://vborg.vbsupport.ru/showthread.php?t=63792&page=1&pp=15) in order to create vB template driven pages.

I think I'm struggling with calling the right variables.

I created a rules.php file in my root dir (my forum sit in root/forums). Here is where I'm at:

<?php

//+GO+TO+FORUM+DIR
chdir('./forums'); <-- Problem

//+STANDARD+VBULLETIN+STUFF
define('NO_REGISTER_GLOBALS',+1);
define('THIS_SCRIPT',+'rules'); <-- Problem
require_once('./global.php');

//+GENERIC_SHELL+VARS
$pagetitle+=+"Title+of+Page";
$HTML+=+"";+//+PIECED+TOGETHER+IN+SCRIPT

eval('$HTML+=+"'+.+fetch_template('forums/static/forum_rules')+.+'";'); <-- Problem

$navbits+=+array();+
$navbits[$parent]+=+'Meganman';+

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

?>

I put my script in the root dir, and when I run it I get:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/adkhighp/public_html/rules.php on line 8

I highlight places I think may be wrong, but I'm not sure. Not sure what error message means, or how to fix it. Any help would be appreciated. Thanks

fetch_template('forums/static/forum_rules') <-- This line calls the php doc i created that I want displayed in the template.

Marco van Herwaarden
09-16-2005, 08:51 PM
If your script is already in your forumhome directory, then there is no need for a chdir.

Also on line 8, the + shouldn't be there:
define('THIS_SCRIPT','rules');

Marco van Herwaarden
09-16-2005, 08:52 PM
Lol, reading your post a bit more, you got + signs everywhere. Looks like you replaced avery space with a plus.

Mavs00
09-16-2005, 09:53 PM
LOL, No that must have been a copy/paste error or something.

The exact code (copied from the server)

<?php

// GO TO FORUM DIR
chdir('./forums');

// STANDARD VBULLETIN STUFF
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'rules');
require_once('./global.php');

// GENERIC_SHELL VARS
$pagetitle = "Title of Page";
$HTML = ""; // PIECED TOGETHER IN SCRIPT

eval('$HTML = "' . fetch_template('forums/static/forum_rules') . '";');

$navbits = array();
$navbits[$parent] = 'Meganman';

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

?>


And it is still getting the same error

Marco van Herwaarden
09-17-2005, 04:47 AM
I just tried, but get no error.

Mavs00
09-17-2005, 04:56 AM
Figured it out, Thanks Marco (I took the link out, as the error code is now gone).

I'll post results for anyone with a similar issue. It's easier than I thought, took a different approach though. First, I took the basic code from the this posted -TEMPLATE- (https://vborg.vbsupport.ru/showthread.php?t=63792&page=1&pp=15)

<?php

// GO TO FORUM DIR
chdir('./forums'); <-- Removed (step 1)

// STANDARD VBULLETIN STUFF
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'script_name');
require_once('./global.php');

// GENERIC_SHELL VARS
$pagetitle = "for_rules"; <-- Changed to custom name
$HTML = ""; // PIECED TOGETHER IN SCRIPT

eval('$HTML = "' . fetch_template('for_rules') . '";'); <-- Changed to custom name

$navbits = array();
$navbits[$parent] = 'Forum Rules';

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

?>


First I removed the {chdir('./forums');} line as Marcho suggested and than changed the other highlighted section to my custom name. Then I saved the file as rules.php in my root forum directory (if you do not save it there any images called on by your vbulletin main.css get lost)

Then I went into vBulletin admin panel;

Styles & Templates --> Style Manager --> Template Options (Add New Template)

and then created a basic html table;

<table width="675" border="1" align="center" cellpadding="3" cellspacing="0" bordercolor="665714">
<tr>
<td bgcolor="#797b56">
<div align="center"><font color="#FFFFFF" size="3" face="Verdana, Arial, Helvetica, sans-serif"><strong>ADKHighPeaks
Forum Rules</strong></font></div></td>
</tr>
<tr>
<td bgcolor="#edebd4"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Added my own bogus text</font></td>
</tr>
</table>

Then saved it as for_rules

That gave me -THIS- (http://www.adkhighpeaks.com/forums/rules.php) , which is exactly what I was looking for.