Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 01-21-2006, 11:08 PM
rob30UK rob30UK is offline
 
Join Date: Oct 2005
Location: UK
Posts: 159
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Simple Page.... no working!!!

Hi,

I'm using some code to pull out a custom template to display in a page with the vBulletin header (no navbar)....

I'm trying to pass in themplate name with a querystring...

Here is the code
PHP Code:
<?php

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

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// pre-cache templates used by all actions
$reqpage $_REQUEST['reqpage'];

$globaltemplates = array(
    
$reqpage,
);

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


    
// Static Pages
    
eval('print_output("' fetch_template($reqpage) . '");');

?>
For some reason I cant understand, it's not working. My code is prolly wrong anyway, I get this error:-

Warning: Division by zero in /includes/functions.php(4314) : eval()'d code on line 10

I know it's failing on the last line, and I've tried others like:-
PHP Code:
eval('print_output("' fetch_template(' + $reqpage + ') . '");'); 
Hopefully someone can see what I'm trying to achieve.... but I just cant get it to work.

What am I doing wrong?

Thanks.
Reply With Quote
  #2  
Old 01-21-2006, 11:13 PM
Daniel's Avatar
Daniel Daniel is offline
 
Join Date: Jul 2005
Location: USA
Posts: 707
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you looked at this tutorial?
https://vborg.vbsupport.ru/showthread.php?t=98009

But from looking over the tutorial I posted above... try this.
Code:
<?php

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

// ##################### DEFINE IMPORTANT CONSTANTS #######################
// change the line below to the actual filename without ".php" extention.
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation.

define('THIS_SCRIPT', 'CHANGE_THIS_TO_YOUR_FILE_NAME'); 

// #################### 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(
        // change the lines below to the list of actual templates used in the script
        'reqpage',
);

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

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

// #################### HARD CODE JAVASCRIPT PATHS ########################
$headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude);

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

$navbits = array(); 
// change the line below to contain whatever you want to show in the navbar (title of your custom page)
$navbits[$parent] = 'Test Page';

// change the line below to contain the name of the actual main output template used in your script
eval('print_output("' . fetch_template('reqpage') . '");');

?>
I'm not a coder or anything, but I tried my best. Best of luck
Reply With Quote
  #3  
Old 01-21-2006, 11:17 PM
Guest190829
Guest
 
Posts: n/a
Default

Some of your code is wrong.

I don't know what this is:


PHP Code:
$reqpage $_REQUEST['reqpage']; 

$globaltemplates = array( 
    
$reqpage
); 

That part should be deleted to this:


PHP Code:
$globaltemplates = array( 
     
'template_name'
 
); 
(Change template_name with the actualy template name of the template your using)

Then the eval should be:


PHP Code:

eval('print_output("' fetch_template('template_name') . '");'); 
Reply With Quote
  #4  
Old 01-21-2006, 11:19 PM
peterska2 peterska2 is offline
 
Join Date: Oct 2003
Location: Manchester, UK
Posts: 6,504
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

try
Code:
eval('print_output("' . fetch_template('reqpage') . '");');
and
Code:
$globaltemplates = array(
    reqpage,
);
in the relevant places


[edit]
Damn, everyone pounced at once!
Reply With Quote
  #5  
Old 01-21-2006, 11:20 PM
Guest190829
Guest
 
Posts: n/a
Default

Ah why is my font green.
Reply With Quote
  #6  
Old 01-21-2006, 11:20 PM
peterska2 peterska2 is offline
 
Join Date: Oct 2003
Location: Manchester, UK
Posts: 6,504
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Danny.VBT
Ah why is my font green.
It's not, it's red
Reply With Quote
  #7  
Old 01-22-2006, 12:08 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Danny.VBT
Some of your code is wrong.

I don't know what this is:


PHP Code:
$reqpage $_REQUEST['reqpage']; 

$globaltemplates = array( 
    
$reqpage
); 

That part should be deleted to this:


PHP Code:
$globaltemplates = array( 
     
'template_name'
 
); 
(Change template_name with the actualy template name of the template your using)

Then the eval should be:


PHP Code:

eval('print_output("' fetch_template('template_name') . '");'); 
He's trying to pull the template in the query string...

Post your actual template here.
Reply With Quote
  #8  
Old 01-22-2006, 07:03 AM
rob30UK rob30UK is offline
 
Join Date: Oct 2005
Location: UK
Posts: 159
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi and thanks everyone above for trying to help.

This php page is a one-size fits all page for static pages.

You pass it the name of the template (via querystring) and the script should grab the template and display it!

Basically, it's called like this:-
pagecontent.php?reqpage=Static_SEO

In this case, Static_SEO is the template name.

SirAdrian, all the templates I've tested this with are certified error free... non of the templates are a problem.... it's this code.

Can I ask everyone to refer back to my original code above and just note that $reqpage is a string variable pulled in from the querystring.

I'm sure the last line is where the error is (maybe?) because the value of $reqpage definitly comes through.

Any ideas?
Reply With Quote
  #9  
Old 01-22-2006, 07:33 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Your php code works fine for me.
Why not humor me and post it (my guess is line 10 of your template)? Also, which version of vBulletin is this?
Reply With Quote
  #10  
Old 01-22-2006, 08:07 AM
rob30UK rob30UK is offline
 
Join Date: Oct 2005
Location: UK
Posts: 159
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is the page I'm requesting with that EXACT php code:-
http://www.webforumz.com/pagecontent...page=STATICSEO

Here is the template which is there as a test:-

Product: vBulletin
Style: Default Style
Title: STATICSEO
Template:
PHP Code:
$stylevar[htmldoctype]
<
html dir="$stylevar[textdirection]lang="$stylevar[languagecode]">
<
head>
<
title>test</title>
$headinclude
</head>
<
body>
$header

<table class="tborder" cellpadding="$stylevar[cellpadding]cellspacing="$stylevar[cellspacing]border="0" width="100%" align="center">
<
tr>
    <
td class="tcat">Title</td>
</
tr>
<
tr>
    <
td class="alt1">Text</td>
</
tr>
</
table>

$footer
</body>
</
html
I'm using vB 3.5.

Here is the php again just for my sanity:-
PHP Code:
<?php

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

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// pre-cache templates used by all actions
$reqpage $_GET['reqpage'];

$globaltemplates = array(
    
$reqpage,
);

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


    
// Static Pages
    
eval('print_output("' fetch_template($reqpage) . '");');



?>
Weird, huh

I can't understand why this is not working.

Ok.... this is really weird..
If I change the last line so it doesnt use a variable, eg:-
PHP Code:
eval('print_output("' fetch_template('STATICSEO') . '");'); 
it works fine...

Yet if I use it like this:-
PHP Code:
eval('print_output("' fetch_template($reqpage) . '");'); 
It does work...even if I user this in place of the get: $reqpage="STATICSEO";

The last line is obviously screwing things up a little.

Any ideas?
Reply With Quote
Reply

Thread Tools
Display Modes

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 05:59 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04993 seconds
  • Memory Usage 2,284KB
  • Queries Executed 11 (?)
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
  • (3)bbcode_code
  • (12)bbcode_php
  • (2)bbcode_quote
  • (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
  • (8)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