mrBjordal
08-08-2007, 11:19 AM
Hi
I am trying to add my own vBulletin-powered pages, but I am new to php and vBulletin.
So far I have created a new file "job1.php" and added a new template at AdminCP. So far so good. Now I want to add more pages like "job2.php", "job3.php", on so on.
File "job1.php"
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'job1'); // 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(
'job1',
);
// pre-cache templates used by specific actions
$actiontemplates = array(
);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
$navbits = array();
$navbits[$parent] = 'Vacant Jobs';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('JobTemplate') . '");');
?>
The template
$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">Title</td>
</tr>
<tr>
<td class="alt1">Text</td>
</tr>
</table>
$footer
</body>
</html>
How do I add variables in the php-file when using the same template for all files? All the php-files does have different titles. I am used to ".asp"-programming. Can I add strings like this and how is the php code for strings:
In the page "job1.php"
#1) in the <title> field: strTitle = "Reception/Office Assistant"
#2) in the <body> field: strEmployer = "Opera Software ASA"
In the page "job2.php"
#1) in the <title> field: strTitle = "Tender Coordinator"
#2) in the <body> field: strEmployer = "FMC Kongsberg Subsea AS"
My two questions:
Question #1) How do I code this in the php files?
Question #2) How do I code this in the template?
Anyone?
:o
I am trying to add my own vBulletin-powered pages, but I am new to php and vBulletin.
So far I have created a new file "job1.php" and added a new template at AdminCP. So far so good. Now I want to add more pages like "job2.php", "job3.php", on so on.
File "job1.php"
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'job1'); // 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(
'job1',
);
// pre-cache templates used by specific actions
$actiontemplates = array(
);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
$navbits = array();
$navbits[$parent] = 'Vacant Jobs';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('JobTemplate') . '");');
?>
The template
$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">Title</td>
</tr>
<tr>
<td class="alt1">Text</td>
</tr>
</table>
$footer
</body>
</html>
How do I add variables in the php-file when using the same template for all files? All the php-files does have different titles. I am used to ".asp"-programming. Can I add strings like this and how is the php code for strings:
In the page "job1.php"
#1) in the <title> field: strTitle = "Reception/Office Assistant"
#2) in the <body> field: strEmployer = "Opera Software ASA"
In the page "job2.php"
#1) in the <title> field: strTitle = "Tender Coordinator"
#2) in the <body> field: strEmployer = "FMC Kongsberg Subsea AS"
My two questions:
Question #1) How do I code this in the php files?
Question #2) How do I code this in the template?
Anyone?
:o