View Full Version : PHP not working - what am I doing wrong.
cono1717
06-06-2009, 05:57 PM
Ok so I am making a custom vBulletin page using VB templates (used the article to make)
and the article said that to make a page inside a file you use.
if($_REQUEST['do'] == 'why') {
{
eval('print_output("' . fetch_template('VIP_WHY') . '");');
}
It should work providing you have a template called vip_why, which I do, however when I go to vip.php?do=why I just the the contents of vip.php and not what should be appearing.
I have placed the code after the ?> and there are no errors, it just doesn't appear.
Can you please tell me what I am doing wrong.
Thanks,
C
Seven Skins
06-06-2009, 09:28 PM
if($_REQUEST['do'] == 'why'){
eval('print_output("' . fetch_template('VIP_WHY') . '");');
}
You have an extra { in your code.
.
Lynne
06-07-2009, 02:34 AM
Also, VIP_WHY is not the same template as vip_why.
cono1717
06-07-2009, 10:13 AM
Thanks for the replys..
@Seven Skins: That was a C&P error of mine, the file actually has
if($_REQUEST['do'] == 'why')
{
eval('print_output("' . fetch_template('vip_why') . '");');
}
@Lynne: Neither VIP_WHY or vip_why work even though the template is called vip_why
Dismounted
06-07-2009, 11:29 AM
That line must be before any other print_output() call. That is what I think the error is.
akanevsky
06-07-2009, 02:26 PM
Can you access any other PHP files, or do they all display contents? If so, does your host support PHP files? If yes, you will need to ask your host to configure PHP file type correctly for your account.
Lynne
06-07-2009, 03:53 PM
Why don't you post the code for your php page and your template here. Make sure to use the php/html code tags.
cono1717
06-07-2009, 04:27 PM
Okie Dokie here is the vip.php file.
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'vip'); // 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(
'VIP_HOME',
);
// pre-cache templates used by specific actions
$actiontemplates = array(
);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
$navbits = array();
$navbits[$parent] = 'VIP Memebership - All you need to know.';
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('vip_home') . '");');
if($_REQUEST['do'] == 'why')
{
eval('print_output("' . fetch_template('vip_why') . '");');
}
?>
Here is my vip_why template
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle] - VIP Membership</title>
$headinclude
</head>
<body>
$header
$navbar
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="25%" style="float: left;">
<tr>
<td class="thead">Navigation</td>
</tr>
<tr>
<td class="alt1"><a href="http://geekstep.com">GeekStep</a>
<br />
<a href="http://geekstep.com/vip.php">VIP Index
<br />
<a href="http://geekstep.com/vip.php?do=why">Why Become a VIP?</a>
<br />
<if condition="!is_member_of($bbuserinfo, 44)">
<a href="http://geekstep.com/payments.php">Become a VIP Member now!</if>
<if condition="is_member_of($bbuserinfo, 44)">
<a href="http://www.geekstep.com/forumdisplay.php?f=141">VIP Zone</a></if>
</td>
</tr>
</table>
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="68%" align="center"><tr>
<td class="tcat">Why become a VIP?</td>
</tr>
<td class="alt1">
http://www.ddraiggoch.co.cc/galleries/geekstep/vip_logo.png
<b><h3><u>What is VIP Membership?</u></h3></b>
VIP Membership is an upgrade to your GeekStep account. You get access to superb new features, more hosting space, better plans and more!
<b><u><h3>What do I get for becoming a VIP?</u></h3></b>
VIP members get hundreds of new features, including:
http://www.ddraiggoch.co.cc/galleries/geekstep/vip_list.png
<b><h3><u>How much is a VIP Membership?</u></h3></b>
VIP Membership is from as slow as $5 a month, with a whole years membership only $20! Some hosting companies charge over $30 for just one month of hosting, with GeekStep you get huge hosting plans and exclusive access for a year for less!
To order, <a href="http://geekstep.com/payments.php">click here</a>
All orders are sent though paypal, and are 100% safe and secure.
</td></tr>
</table>
<br /><br />
$footer
<div id="smallfont" align="center">
VIP Section created by Connor
</div>
</body>
</html>
ForumsMods
06-07-2009, 04:52 PM
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'vip'); // 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(
'VIP_HOME',
);
// pre-cache templates used by specific actions
$actiontemplates = array(
);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
$navbits = array();
$navbits[$parent] = 'VIP Memebership - All you need to know.';
$navbits = construct_navbits($navbits);
if($_REQUEST['do'] == 'why')
{
eval('print_output("' . fetch_template('vip_why') . '");');
}
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('vip_home') . '");');
?>
Lynne
06-07-2009, 04:53 PM
Once you have an eval print_output, that's it. You need to have yours before the other one. Something more like this:
if($_REQUEST['do'] == 'why')
{
eval('print_output("' . fetch_template('vip_why') . '");');
}
else
{
eval('print_output("' . fetch_template('vip_home') . '");');
}
cono1717
06-07-2009, 05:17 PM
Thanks for all your help, this is fixed now!
Thank you.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.