MusicMan
11-19-2005, 08:44 PM
Hello, I'm trying to learn coding, I don't know a whole lot. I am developing a vbulletin 3.5.1 board and I have a question to ask about something that is pretty simple, but keeping me from progressing with development.
I found that you can make a template in the AdminCP Style Manager. I also found another thread here with code to copy to get the page to call up the template or whatever. As of right now, I have a way to make a "rules page" that will match the style of my board, but it seems that the text displayed on the page is part of the coding in the template, not in the rules.php file. Let me explain...
Here is the template I have in my AdminCP. It is named "rules".
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header
$navbar
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat">Rules</td>
</tr>
<tr>
<td class="alt1">Text</td>
</tr>
</table>
$footer
</body>
</html>
Then I inserted the following code to make a test page (named rules.php)
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'rules'); // 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(
'rules',
);
// pre-cache templates used by specific actions
$actiontemplates = array(
);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
$navbits = array();
$navbits[$parent] = 'Test Page';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('rules') . '");');
?>
What is happening is the rules.php file displays the correct style and layout of my site, the navbits show rules-related text, but the table just shows "text". So I assume I can go into the "rules template" and insert whatever text I want and it will display correctly...BUT...My goal is to have a template that I can change the text and navbits without changing the actual template. I plan on creating a lot of pages, so creating thousands of unique templates is not an option. So if someone could help me out with this issue which is probably very simple, I'd appreciate it a lot. Oh and try to "dumb it down" for someone who is brand new to coding. ;)
I found that you can make a template in the AdminCP Style Manager. I also found another thread here with code to copy to get the page to call up the template or whatever. As of right now, I have a way to make a "rules page" that will match the style of my board, but it seems that the text displayed on the page is part of the coding in the template, not in the rules.php file. Let me explain...
Here is the template I have in my AdminCP. It is named "rules".
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header
$navbar
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat">Rules</td>
</tr>
<tr>
<td class="alt1">Text</td>
</tr>
</table>
$footer
</body>
</html>
Then I inserted the following code to make a test page (named rules.php)
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'rules'); // 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(
'rules',
);
// pre-cache templates used by specific actions
$actiontemplates = array(
);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
$navbits = array();
$navbits[$parent] = 'Test Page';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('rules') . '");');
?>
What is happening is the rules.php file displays the correct style and layout of my site, the navbits show rules-related text, but the table just shows "text". So I assume I can go into the "rules template" and insert whatever text I want and it will display correctly...BUT...My goal is to have a template that I can change the text and navbits without changing the actual template. I plan on creating a lot of pages, so creating thousands of unique templates is not an option. So if someone could help me out with this issue which is probably very simple, I'd appreciate it a lot. Oh and try to "dumb it down" for someone who is brand new to coding. ;)