1
erzon
Show avatar in theme.htm
  • 2005/6/1 16:15

  • erzon

  • Quite a regular

  • Posts: 211

  • Since: 2005/1/1 3


what is the best way to show users avatar in your theme.html? i try the <{$user.avatar}> code. it works but the avatar show is not the avatar of the user..and i try to login using other name the avatar is still the same..

did i miss something to correct this?

and also if you want to show the current post in theme.html?

2
erzon
Re: Show avatar in theme.htm
  • 2005/6/2 15:15

  • erzon

  • Quite a regular

  • Posts: 211

  • Since: 2005/1/1 3


any help on this one?

3
erzon
Re: Show avatar in theme.htm
  • 2005/6/3 14:50

  • erzon

  • Quite a regular

  • Posts: 211

  • Since: 2005/1/1 3


i need help pls anyone know this?

4
Herko
Re: Show avatar in theme.htm
  • 2005/6/3 14:56

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


IMHO you're confusing the theme.html file with what you have custom blocks for. The theme.html code is loaded with very page, and the variables you're trying to call are not, and are definately not personalised (how does theme.html know who you are?).

Check the FAQ for information on how you can add the PM information to your theme file, or to a custom block. That should give you some ideas on how to add module specific information from blocks to your theme file.

Herko

5
LazyBadger
Re: Show avatar in theme.htm

With caution you can use smth. like this code
global $xoopsUser;

if (
is_object($xoopsUser)) {
    
$avatar $xoopsUser->getVar('user_avatar');
    if (
file_exists(XOOPS_ROOT_PATH.'/uploads/'.$avatar)) { 
    
$avatar '.XOOPS_URL.'/uploads/'.$avatar'" alt="avatar" />';
            } else {
            
$avatar '';


But using php inside theme is bad style and violate principle of separation logic from code. If you include_php and will use additional smarty-var in your theme it can be considered as "right way" (from some POVs)

6
erzon
Re: Show avatar in theme.htm
  • 2005/6/3 15:32

  • erzon

  • Quite a regular

  • Posts: 211

  • Since: 2005/1/1 3


Quote:

LazyBadger wrote:
With caution you can use smth. like this code
global $xoopsUser;

if (
is_object($xoopsUser)) {
    
$avatar $xoopsUser->getVar('user_avatar');
    if (
file_exists(XOOPS_ROOT_PATH.'/uploads/'.$avatar)) { 
    
$avatar '.XOOPS_URL.'/uploads/'.$avatar'" alt="avatar" />';
            } else {
            
$avatar '';


But using php inside theme is bad style and violate principle of separation logic from code. If you include_php and will use additional smarty-var in your theme it can be considered as "right way" (from some POVs)



is this code work? if you include the php code in theme.html is that ok or too risky?

7
Herko
Re: Show avatar in theme.htm
  • 2005/6/3 15:48

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


the theme file is an HTML file, which means it will not interpret the code as php.

Herko

8
erzon
Re: Show avatar in theme.htm
  • 2005/6/4 5:51

  • erzon

  • Quite a regular

  • Posts: 211

  • Since: 2005/1/1 3


yes it can..you can put php in theme.html it just happen i dont know what variable to call for that avatar to show

Login

Who's Online

262 user(s) are online (190 user(s) are browsing Support Forums)


Members: 0


Guests: 262


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits