Firefox PHP

accessing $PHORUM array in template??

Posted by asdfasdf4285 
accessing $PHORUM array in template??
January 10, 2005 01:11AM
//in index.php i added this lines,
$PHORUM["DATA"]["LANG"]["last_msg"]["body"]="blah";
echo PHORUM["DATA"]["LANG"]["last_msg"]["body"];
//works great, but i wanna use templates to do formating

i was kind of hoping that i just have to add
{LANG->last_msg->body} in the index template, but dont work...
...really lost...
how do i access vars in the template, that are genearated in the php file????
Re: accessing $PHORUM array in template??
January 10, 2005 03:17AM
LANG is a special array. you should just stuff your vars in $PHORUM['DATA'], then you can use this as a direct var.


Thomas Seifert
Re: accessing $PHORUM array in template??
January 10, 2005 03:53AM
stufed it in
$PHORUM["DATA"]["msg"]
tryed just $PHORUM["DATA"] but that scrued up everything lol
but {FORUMS->DATA->msg} in index.tpl seems to be emty still

is the FORUMS arry in the tpl file a different array then the one in the php file? is there some sort of string replacement performent to display the data?
Re: accessing $PHORUM array in template??
January 10, 2005 04:02AM
don't use this var, its used elsewhere by phorum for its messages, use something different ;).

$PHORUM["DATA"]["msg"]

would be {msg} in the template.

all data which is used in the template is in $PHORUM['DATA'] (which is an array).


Thomas Seifert
Re: accessing $PHORUM array in template??
January 10, 2005 05:02PM
cool that worked...but i want to stuff an message array into $PHORUM["DATA"]["msg"] itll be a last posted message preview, in the index page

$PHORUM["DATA"]["msg"]=phorum_db_get_message(phorum_db_get_last_msg_id($forum["forum_id"]);

echo $PHORUM["DATA"]["msg"]["body]; //will pint last posted message body

but [msg->body} is embty....is body not an element in array msg?
Re: accessing $PHORUM array in template??
January 10, 2005 05:05PM
<?php
print_var($PHORUM['DATA']['msg']);
?>

... in the template will tell you whats in there.


Thomas Seifert
Re: accessing $PHORUM array in template??
January 11, 2005 05:20PM
ts77 Wrote:
-------------------------------------------------------
> <?php
> print_var($PHORUM['DATA']['msg']);
> ?>

did you mean print_r...




---
-=[ Panu ]=-
Re: accessing $PHORUM array in template??
January 11, 2005 05:23PM
nope, print_var ... its defined in common.php and is a wrapper around print_r ;).


Thomas Seifert
Re: accessing $PHORUM array in template??
January 11, 2005 07:13PM
aaa, no wonder it's not on PHP manual :)

I'll learn something new everyday...

---
-=[ Panu ]=-
Re: accessing $PHORUM array in template??
January 13, 2005 11:02AM
print_r is the most useless function in the world without a wrapper. I and a coworker patched and proposed a change to allow an optional HTML flag to the function. It was denied by the PHP team.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Sorry, only registered users may post in this forum.

Click here to login