PDA

View Full Version : PHP page with my VB forum style


MadKad
07-24-2006, 01:27 PM
Hi I asked this question here, please read to understand what I am going to ask :)

https://vborg.vbsupport.ru/showthread.php?t=121741

What it is I want is to be able to just have a php pahe with all the code that is needed for the php page like MP3 did here (https://vborg.vbsupport.ru/showpost.php?p=1034797&postcount=2) then this template also in the code



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

include('file.php');

$footer
</body>
</html>


I can do some php but this is out of my leage, the using a template was good idea and worked but i couldnt add the php include in :confused:

Can some one help on this :confused: or is it a big job?

Dpcows
07-25-2006, 06:08 AM
Hi there,

It seems you are trying to execute PHP (an include) in your template.
Wich is not possible, a template is just text that is being read and has no PHP capability's.

You should and move that include to your .php file.
And use the variables of that file in your templates.

Hope this is a little bit clear

MadKad
07-25-2006, 06:21 AM
yer thats what I want but I dont know how to add the variables to my php page, as I am not that good on php so I was hoping some one would help me do that bit


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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'MP3'); // 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(
'mp3',
);

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

);

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

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


$navbits = array();
$navbits[$parent] = 'MP3 Home Page';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('mp3') . '");');
?>


using that code and just a standerd layout template like


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

include('file.php');

$footer
</body>
</html>


that but within the php file and not a template :confused:

Dpcows
07-25-2006, 06:26 AM
Move this: include('file.php'); from the template to your php file after:

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

And then depending on your file.php, use the variables in that file in your template.

MadKad
07-25-2006, 07:27 AM
is there know way I can do it the other way and just add the template to the php file like these $footer, $header, $navbar etc etc......

that way all I have to do is add the include for the files I need, its just that there scripts these other files

Dpcows
07-25-2006, 10:37 AM
Not that I know and I woudn't advise it.
The template system is a powerfull tool.

Why not take the time and efford to learn how to use it ?

MadKad
07-25-2006, 11:04 AM
lol i know how to use the templates section as I have done mods using it, I just want to be able to pull some info from there into some php pages, it must be able to be done as some mod do this.

Can any one help on this??