vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Can someone Walk me through it? (https://vborg.vbsupport.ru/showthread.php?t=46532)

JakeC 12-10-2002 04:47 AM

Can someone Walk me through it?
 
Can someone walk me through the process and theory behind making a Variable visible in a template that it was not intended for? I am trying to integrate $activeusers, $totalonline and some others into my $welcometext and they will not show up. I was told that this requires some hacking, so here I am. I am fairly proficient at modifying templates, but the inner workings of vB is a mystery. I want to change that ASAP so maybe I can give out some advice for a change. Thanks in advance.

JakeC

By the way, one of you super vB hackers out there that can swing a pen ought to write a "How to hack vB" book. Not necessarily a book on PHP per say but one that walks you through like 10-15 sample hacks from easy to complicated. I'd buy one.

Xenon 12-10-2002 04:03 PM

well, learning from a book don't work i think.
best way is learning by doing.
try and error rules ;)

to answer your question:
the variables must be defined inside of the function which calls the template, so you have to edit a php-file (index.php in this case)

and there before you parse the template (gettemplate function will be seen in the sourcecode ;)) you have to add something like $activx = "Blabla", then you can use $activx in your template

Graphics 12-10-2002 04:05 PM

LOL i don't think instilling hacks is that hard most of the time there is a help file :D

but ALWAYS try on a other forum first :D

NTLDR 12-10-2002 06:58 PM

Make sure the variables are assigned the values before the template is evaluated.

JakeC 12-10-2002 09:19 PM

Ok, the light is beginning to shine a little brighter but I need you guys to break it down even further. Is there any way you could give me an example. Maybe walk me through all of the steps so I can get an idea of what is doing what and why it works. I am a rank beginner so allot of the terms and tasks you mentioned are a little new to me. Thanks.

JakeC

NTLDR 12-11-2002 05:33 PM

PHP Code:

eval("\$hw = \"".gettemplate('hw')."\";");
$outputtext "Hello World"

Adding $outputtext to the hw won't work as its assigned after the template is evaluated, however doing it this way will work as its assigned before the template is evaluated:

PHP Code:

$outputtext "Hello World";
eval(
"\$hw = \"".gettemplate('hw')."\";"); 


NTLDR 12-11-2002 05:38 PM

Quote:

Originally posted by Xenon
to answer your question:
the variables must be defined inside of the function which calls the template, so you have to edit a php-file (index.php in this case)[/B]
PHP Code:

$d="1";
function 
a($a) {

    if (
$d=="1") {
        
$c=2;
    }


$d won't be set and can't be used, however either of the following two methods will work:

PHP Code:

function a($a) {
    
$d="1";
    if (
$d=="1") {
        
$c=2;
    }


PHP Code:

$d=1;
function 
a($a) {
    global 
$d;
    if (
$d=="1") {
        
$c=2;
    }




All times are GMT. The time now is 08:04 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.01109 seconds
  • Memory Usage 1,734KB
  • 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
  • (5)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete