vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   PHP not working - what am I doing wrong. (https://vborg.vbsupport.ru/showthread.php?t=215512)

cono1717 06-06-2009 05:57 PM

PHP not working - what am I doing wrong.
 
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.

PHP Code:

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

Code:

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

PHP Code:

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 Code:

<?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

HTML Code:

$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">
[img]http://www.ddraiggoch.co.cc/galleries/geekstep/vip_logo.png[/img]

<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:

[img]http://www.ddraiggoch.co.cc/galleries/geekstep/vip_list.png[/img]

<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 Code:

<?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:
PHP Code:

if($_REQUEST['do'] == 'why')
{
    eval(
'print_output("' fetch_template('vip_why') . '");');

else
{
eval(
'print_output("' fetch_template('vip_home') . '");');




All times are GMT. The time now is 01:04 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01257 seconds
  • Memory Usage 1,773KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_html_printable
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete