Log in

View Full Version : accessing function() values in custom page


Oreamnos
11-25-2005, 01:00 AM
i have a custom page with some functions that return values. Example:
function test() {

$print_this = "hello!";
return $print_this;

}

but if i put $print_this in my template it doesn't show anything. if i just have $print_this = "hello!"; outside of the function, and $print_this in my teemplate, it works.

how do i handle data that is produced in a function in my templates?

eric

Adrian Schneider
11-25-2005, 01:27 AM
function test()
{
return 5;
}

$num = test();

<!-- This Works -->
some number is $num
OR

function test();
{
global $num;
$num = 5;
}

<!-- This also Works -->
some number is $num

Oreamnos
11-25-2005, 02:50 AM
thanks! :)