Log in

View Full Version : echoing a $vboption via the script


sabret00the
12-06-2004, 09:34 PM
i'm wondering why this won't work
$grps_pagetitle = "Groups @ $vboption[hometitle]";


i though ok if that won't work $grps_pagetitle = "Groups @" . '$vboption[hometitle]' . "";
but that just had the same results as $grps_pagetitle = "Groups @ \$vboption[hometitle]";

i'm wondering what i'm doing wrong.

filburt1
12-06-2004, 09:42 PM
Single quotes don't parse variables, which is the main difference from double quotes.

This form is preferable:

$grps_pagetitle = "Groups @ " . $vboption['hometitle'];

Always use single quotes for constant array keys, no exceptions. I hate how vB's templates rely on deprecated methods to access arrays.

Also, note that

. ""

...does nothing at all.

filburt1
12-06-2004, 09:42 PM
Also, I just recalled that @ has special meaning in PHP (it surpresses warnings and errors). Be careful when using it.

sabret00the
12-06-2004, 10:17 PM
Also, I just recalled that @ has special meaning in PHP (it surpresses warnings and errors). Be careful when using it.
thanks, although the vboption[hometitle] still doesn't echo, if i type it into a template it echo's fine, just not via the script directly?

sabret00the
12-07-2004, 09:30 AM
*bump*

sabret00the
12-07-2004, 02:38 PM
doh it's $vboptions[array] not $vboption[array]

Natch
12-08-2004, 09:20 AM
Was just gonna suggest that ;)