PDA

View Full Version : Quick Question - Defining Variables


.:.NetStartz.:.
02-20-2003, 11:54 AM
I've been trying this for several days before I decided to seek help. Myself and my partner have put a lot of work into the board/site and I don't want to ruin it by messing up one file.

Basically I would like to use my custom template ( custom_template ) by calling the variable $custom

Where would I go or how would I define that variable so it would work everywhere on my board including myVBindex and custom php pages made.

Thanks,
:classic:

Xenon
02-20-2003, 11:57 AM
you have to create it within global.php where $header and $footer are defined :)

.:.NetStartz.:.
02-20-2003, 11:59 AM
Could you tell me how... ;)

.:.NetStartz.:.
02-20-2003, 12:02 PM
Do I find
eval("\$footer .= \"".gettemplate('footer')."\";");

and replace it witheval("\$footer .= \"".gettemplate('footer')."\";");
eval("\$custom .= \"".gettemplate('custom_template')."\";");

?

.:.NetStartz.:.
02-20-2003, 12:10 PM
If so...that gives me the following error...

Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/eogn/public_html/forum/global.php(321) : eval()'d code on line 1

Xenon
02-20-2003, 12:19 PM
eval("\$custom = \"".gettemplate('custom_template')."\";");

.:.NetStartz.:.
02-20-2003, 12:26 PM
Heres a piece of my global.php file after the changes.

$header='';
$footer='';

// parse PHP include ##################
eval(gettemplate('phpinclude',0,0));

// parse css, header & footer ##################
eval("\$headinclude = \"".gettemplate('headinclude')."\";");
eval("\$header .= \"".gettemplate('header')."\";");
eval("\$footer .= \"".gettemplate('footer')."\";");

// custom templates ##################
eval("\$468x60 = \"".gettemplate('ads_468x60_main')."\";");

// parse other global templates

eval("\$gobutton = \"".gettemplate('gobutton')."\";");


But then I get this error.
Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/eogn/public_html/forum/global.php(321) : eval()'d code on line 1

Xenon
02-20-2003, 12:41 PM
AFAIK $468x60 is no valid varname

php varialbes have to start with an letter as far as i know..

.:.NetStartz.:.
02-20-2003, 01:00 PM
Thanks -- Works like a charm.

Xenon
02-20-2003, 01:13 PM
you're welcome :)