PDA

View Full Version : use php without making a plugin


CampinCarl
11-24-2008, 10:48 PM
I need to be able to use php without having to make a plugin. Using a plugin is impractical and annoying and im trying to code a homepage for my site using a method someone posted before so i can use he header and stuff.

Heres my site
Where it says PHP TESTING i tryed a simple echo "php testing"; but it wouldnt work >:(
thx for help
http://hldevs.com/

Lynne
11-24-2008, 10:58 PM
No need to use plugins when it is a totally custom page (as is your case). Perhaps post the code for your page here and we can see what is wrong.

If you look at the page source, you'll see this:
<td class='alt1'><?php echo "plop"; ?></td>

So, we can see you tried to do something, but if you put that in a template, that is exactly what will happen since you can't put php in a template. You must put php in the php page.

CampinCarl
11-24-2008, 11:28 PM
heres the code im using
<?php

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

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

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

);

// ######################### REQUIRE BACK-END ############################
define('VB_AREA', 'Forum');
define('CWD', 'C:/inetpub/vhosts/hldevs.com/httpdocs/forums');
require_once(CWD . '/global.php');
require_once(CWD . '/includes/init.php');

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

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

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

?>

and the header and stuff is in the test template so i couldnt figure out how to put the php in there

SEOvB
11-24-2008, 11:35 PM
Your making a vBulletin powered page driven by a template so you want be able to put php inside your test template. You need to use a different page format.

CampinCarl
11-24-2008, 11:44 PM
could you show me how to do that? :)

Lynne
11-25-2008, 03:03 AM
You need to have something like this in your php page (what you posted above) after the start of the main script and before the navbits stuff. :
$testing = 'plop';


And then in your template, you would go:
<td class='alt1'>$testing</td>

CampinCarl
11-25-2008, 10:02 PM
oh ok
thanks for your help 8)