1
deka87
Need help with a little code
  • 2009/8/20 12:41

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


hi, i'm trying to do something with the userinfo page but it just won't work. I have created a field which is called 'vice_versa' in the registration form and it is a yes/no radio button. I have added this code in the userinfo.php:
$profile_handler =& xoops_getmodulehandler('profile''profile'); 
$profile $profile_handler->get($uid); 

if (
is_object($profile)) { 
    
$vice_versa $profile->getVar('vice_versa'); 
}


and

$xoopsTpl->assign('vice_versa'$vice_versa);


and in the template userinfo.html

<{if $vice_versa == yes}>Something here<{/if}>


But it just won't show the text. does anybody know what's wrong?

thanks in advance

2
urbanspacema
Re: Need help with a little code

try

<{if $vice_versa == 1}>Something here<{/if}>
instead of
<{if $vice_versa == yes}>Something here<{/if}>

3
ghia
Re: Need help with a little code
  • 2009/8/20 12:51

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


In your first code bloc you need to provide a default value for $vice_versa before the if.
Because of the ?, could it be possible that you have two different characters c used?
Check in the database how the yes no button value is saved. It can be 1 and 0.
If it is yes then the compare must be with string 'yes'.
Use <{$vice_versa}> in your template to see if the value is there and what is in it.

4
deka87
Re: Need help with a little code
  • 2009/8/20 13:38

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


actually both of you guys were right. it should has been the '1' value instead of the 'yes' one. and the second is that ? sign which actually looked alright in my code. The ? that popped up here turned out to be the cyrillic 'c'. It was difficult to notice right away cos it looks the same and on the same position on the keyboard. thanks again guys

Login

Who's Online

246 user(s) are online (163 user(s) are browsing Support Forums)


Members: 0


Guests: 246


more...

Donat-O-Meter

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

Latest GitHub Commits