solved or statement not working

mountaintop
@mountaintop
5 years ago
76 posts
not sure why or is not working

{if $profile_quota_id = '44' }works
{if $item.profile_quota_id = '44' }works

{if $profile_quota_id == '44'} does not work
{if $item.profile_quota_id == '44'} does not work

{if $profile_quota_id == '44' || $profile_quota_id == '6' } does not work with all the variants above tried $item.p ....
{if $profile_quota_id eq '44' or $profile_quota_id eq '6' } does not work also tried all variants eg. " instead of '

any suggestions?

thks



--
jesan
FRC All Music

updated by @mountaintop: 08/06/19 10:24:16AM
michael
@michael
5 years ago
7,714 posts
this:
{if $profile_quota_id = '44' }
is setting the value of $profile_quota_id to 44.

This:
{if $profile_quota_id == '44'} 
is checking if the value of profile_quota_id is 44
mountaintop
@mountaintop
5 years ago
76 posts
Hi Michael,
thanks for your suggestion sorry, I may was not clear, in my frustration tried everything

why is the or Statement not working

{if $profile_quota_id == '44' || $profile_quota_id == '6' }

tried smarty version

{if $profile_quota_id eq '44' or $profile_quota_id eq '6' }

just tried all sorts of things

it used to work before, I miss something


--
jesan
FRC All Music
michael
@michael
5 years ago
7,714 posts
I don't know what $profile_quota_id is in that template location, but I guess that its not '44'.

What I would do is add:
THE VALUE OF $profile_quota_id IS: {$profile_quota_id}
to the template to see what the value of it is.

The other way to see what it is is to add a {debug}.

Docs: "{debug}"
https://www.jamroom.net/the-jamroom-network/documentation/module-developer-guide/1477/debug
mountaintop
@mountaintop
5 years ago
76 posts
thanks for the tip

without the or statment 44 works and shows the correct info when I try to include an or statment to display for another id it does not work anymore

if I do if .... 44

else

if 6

endif

this works

just the or is a mystery


--
jesan
FRC All Music
paul
@paul
5 years ago
4,326 posts
This works as expected for me -
{$x = 3}
{if $x == '3' || $x == '6'}
    {$x}
    <br>
{/if}
{$x = 6}
{if $x == 3 || $x == 6}
    {$x}
    <br>
{/if}
{$x = 9}
{if $x == 3 || $x == 6}
    {$x}
    <br>
{/if}
Even when adding the inverted commas around the numbers (which are not needed for numeric values btw).
I can only think that something before or after this code in your template is causing it to fail.
Anything in the error logs?


--
Paul Asher - JR Developer and System Import Specialist
mountaintop
@mountaintop
5 years ago
76 posts
agree it should work, nothing in the error logs, it used to work,

have reset cache, run integrity check

will try to run debug


--
jesan
FRC All Music
mountaintop
@mountaintop
5 years ago
76 posts
I'm convinced SW is black magic, I changed to chrome from Firefox to edit the template file

it works same code :(

thanks for your help


--
jesan
FRC All Music