$user.username into PHP variable in template...

rums

Joined: 2006-05-10
Posts: 1
Posted: Wed, 2006-05-10 21:39

Hello,

I'm having a problem getting the username into a block of PHP inside of the album.tpl file.

Generally, what I'm doing is that each time a user loads an album page, I'm logging their activity to a file. I had this code working fine in Gallery1, but now in Gallery2 I can't get it going. Here's what I've put into the album.tpl of my theme:

{php}
$logpath = "/usr/share/gallerylogs/log.html";
$username = $user.userName;

$fp = fopen($logpath, "a");
fputs($fp, date("H:i:s m/d/y") . "- $username -  \n");
fclose($fp);
{/php}

The problem is that $user.userName does not work inside of the {php} tags -- just outside (for example, I can render the username onto the screen just by putting {user.userName} somewhere else in the template.

My question is this: is there anyway to access the userName from within the PHP block?

Thanks!

 
mrkukov

Joined: 2007-12-25
Posts: 3
Posted: Wed, 2009-02-18 16:22

dump