Welcome Guest, Not a member yet? Register   Sign In
comparison condition is not true
#1

[eluser]alberta[/eluser]
hello,

I am using parse. On view page i've this code.

Code:
<?php
     if( ('{status}' == 'Active') || ('{status}' == 'Inactive')) { ?>
     <td><a href='projects/change_status/{status}/{id}'>{status}</a></td>
        &lt;?php } else {?&gt;
    <td>{status}</td>
    &lt;?php } ?&gt;

but it always goes to else part even status is Active or Inactive Sad

Kindly guide me What's wrong with this code?
Thanks in advance
#2

[eluser]Wuushu[/eluser]
Code:
&lt;?php
     if( ({status} == 'Active') || ({status} == 'Inactive')) { ?&gt;
     <td><a href='projects/change_status/{status}/{id}'>{status}</a></td>
        &lt;?php } else {?&gt;
    <td>{status}</td>
    &lt;?php } ?&gt;

Does that work better?
#3

[eluser]tomcode[/eluser]
Would be surprised that Your solutions work, so here's my take :

Code:
&lt;?php

     if( $status == 'Active' || $status == 'Inactive' ) :

?&gt;
     <td><a href='projects/change_status/{status}/{id}'>{status}</a></td>
&lt;?php

     else :

?&gt;
    <td>{status}</td>

&lt;?php

     endif;

?&gt;
#4

[eluser]alberta[/eluser]
Hey I have tried both of the code suggested by you people. But both r not working. As i'd told em using parser so it is showing me value when i write '{status}' instead of $status or {status}. I have echoed the values and it is showing exact value when i write '{$status}' but inspite of this it goes to else part. I dont know what's wrong with it Sad
#5

[eluser]tomcode[/eluser]
Is the PHP parsed ?
#6

[eluser]alberta[/eluser]
what i meant by parser was that I am using template parser

http://ellislab.com/codeigniter/user-gui...arser.html

and for that i would have to wirte '{status}'
#7

[eluser]alberta[/eluser]
Can some one tell me how i can put this if conditon alongwith template parser. As i've written code above. I have searched a lot but found no solution Sad this template parser is really creating problems for me.

Any help would be appreciated




Theme © iAndrew 2016 - Forum software by © MyBB