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

Reply
 
Thread Tools Display Modes
  #1  
Old 10-31-2003, 01:30 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default page within a page?

if i've got a page that does what it's meant to do, how do i go about making it have &page=whatever ?

would i need to enclose it all in a switch function or can i add some sort of if statement?
Reply With Quote
  #2  
Old 10-31-2003, 01:37 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It really all depends how you want it to work, for example:

PHP Code:
<?php

require('./global.php');

eval(
"dooutput(\"".gettemplate($page)."\");"); 

?>
Thats the basic code for vB2 to get a page based on file.php?page=pagename you could also have a switch/if block to change between a pre-defined set of pages.
Reply With Quote
  #3  
Old 10-31-2003, 01:43 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm, sorry a little confused, this is my first attempt at a vB hack really

basically i got a bunch of code on the page which calls how the main page looks but i wanna add main.php&page=rules

would i just add that into the bottom of the main script?
Reply With Quote
  #4  
Old 10-31-2003, 01:57 PM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You're being vague still.

The parameters in a URL, which are variables, can be used in php like this:

PHP Code:
if($_GET['page'] == 'rules')
{
// code here

Reply With Quote
  #5  
Old 10-31-2003, 01:58 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Assuming you already have all the PHP in place to do the main page, all you would need is somthing like:

PHP Code:
eval("\$content = \"".gettemplate("mypage_{$page}")."\";"); 
Where $page is whats in the URL (x.php?page=rules), you need to make sure this goes above the dooutput line you'll have that would look similar to the one I posted above. In your main template, add $content where you want the content of the template to go. Note the mypage in the above line, I'd recommend using a prefix to prevent users looking at templates they shouldn't
Reply With Quote
  #6  
Old 10-31-2003, 02:16 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
<?php
error_reporting
(7);
$templatesused 'confessions,confessionbit,confession_adminoptions,confession_error,confession_pagenav,confession_leftside';
require(
"./global.php");
 
// all the code that makes the page work 
 
if($_GET['page'] == 'privacy'

eval(
"\$content = \"".gettemplate("confessionprivacy")."\";");

?>
i know that aint right cos it don't work but something like that?
Reply With Quote
  #7  
Old 10-31-2003, 02:20 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
require_once("./global.php");

switch (
$_GET['show'])
{
    case 
"something":
        eval(
"dooutput(\"" gettemplate("sometemplate") . "\");");
        break;

    case 
"somethingelse":
        eval(
"dooutput(\"" gettemplate("someothertemplate") . "\");");
        break;

Reply With Quote
  #8  
Old 10-31-2003, 02:57 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i thought i would've ended up doing something like that, thanks filburt


arghhh, i suck at php, this is what i tried
PHP Code:
switch ($_GET['show']) 

    case 
"privacy"
        eval(
"dooutput(\"" gettemplate("confession_privacy") . "\");"); 
    break; 
    case 
"confess"
        eval(
"dooutput(\"" gettemplate("confession_confess") . "\");"); 
    break; 
    default: 
        eval(
"
              
$confessions = $DB_site->query("SELECT confessionidtexttimestamp FROM confessions $clause ORDER BY confessionid DESC $limit");
            
                if (!
$DB_site->num_rows($confessions)) {
                  eval("
\$confessionbits = \"".gettemplate("confession_error",1,0)."\";");
                }
            
                else {
                  while (
$confession_info $DB_site->fetch_array($confessions)) {
                    
extract($confession_info);
        
                    
$color       = ($num++ % == 0) ? '{firstaltcolor}' '{secondaltcolor}';
                    
$totalconf number_format($DB_site->num_rows($confessions));
                    
$time_posted vbdate('n-j-y, g:i:s a'$timestamp);
                    
$text  bbcodeparse($text);
            
                      if (
$bbuserinfo[usergroupid] == || $bbuserinfo[usergroupid] == || $bbuserinfo[usergroupid] == 7) {
                        eval(
"\$adminoptions = \"".gettemplate("confession_adminoptions",1,0)."\";");
                      }
            
                    eval(
"\$confessionbits .= \"".gettemplate("confessionbit",1,0)."\";");
                  }
                }
            
"); 
        break; 

can't get to work
Reply With Quote
  #9  
Old 10-31-2003, 04:20 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

*bump plea for help*
Reply With Quote
  #10  
Old 10-31-2003, 06:31 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You might want to remove that big eval(" ") around everything
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 10:57 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.10103 seconds
  • Memory Usage 2,284KB
  • 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
  • (6)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_postinfo_query
  • fetch_postinfo
  • 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