Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-06-2009, 05:57 PM
cono1717 cono1717 is offline
 
Join Date: Sep 2008
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 06-06-2009, 09:28 PM
Seven Skins's Avatar
Seven Skins Seven Skins is offline
 
Join Date: Sep 2008
Location: London, UK
Posts: 1,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
if($_REQUEST['do'] == 'why'){
eval('print_output("' . fetch_template('VIP_WHY') . '");');
}
You have an extra { in your code.

.
Reply With Quote
  #3  
Old 06-07-2009, 02:34 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Also, VIP_WHY is not the same template as vip_why.
Reply With Quote
  #4  
Old 06-07-2009, 10:13 AM
cono1717 cono1717 is offline
 
Join Date: Sep 2008
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #5  
Old 06-07-2009, 11:29 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That line must be before any other print_output() call. That is what I think the error is.
Reply With Quote
  #6  
Old 06-07-2009, 02:26 PM
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Posts: 3,972
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 06-07-2009, 03:53 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why don't you post the code for your php page and your template here. Make sure to use the php/html code tags.
Reply With Quote
  #8  
Old 06-07-2009, 04:27 PM
cono1717 cono1717 is offline
 
Join Date: Sep 2008
Posts: 165
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
  #9  
Old 06-07-2009, 04:52 PM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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') . '");');

?>
Reply With Quote
  #10  
Old 06-07-2009, 04:53 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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') . '");');

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:58 AM.


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.04591 seconds
  • Memory Usage 2,290KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_html
  • (5)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete