Use the if label instead of the empty label, because there is also the else. {Code. However, I have tried several condition terms. Why not? 1) & amp; lt; ifcondition & quot; Think. session. user & #039; & #039; & quot; & amp; gt; or 2) & amp; lt; if... use the if label instead of the empty label, because there is also the else.
Login
Note volume
{$ Think. session. user}
It is acceptable to test the above.
However, I have tried several condition terms. Why not?
1)
Or
2)
Or
3)
Or
4)
What I want to know is: why can't the above four methods work?
If I don't want to use $ _ SESSION and want to use Think. session. user, how should I write the condition part?
Reply content:
Use the if label instead of the empty label, because there is also the else.
Login
Note volume
{$ Think. session. user}
It is acceptable to test the above.
However, I have tried several condition terms. Why not?
1)
Or
2)
Or
3)
Or
4)
What I want to know is: why can't the above four methods work?
If I don't want to use $ _ SESSION and want to use Think. session. user, how should I write the condition part?
Empty also has else usage.
You can try it like this:
{$ Think. session. user}
Login
Note volume
Tp has an empty tag to determine whether it is empty.
You can determine whether the session ("user") exists in the Controller. If the session exists, the user parameter is passed to the template. If the session does not exist, the user parameter is not passed. In the template, determine whether the $ user variable exists.
For example
// In TP, the session is enabled by default ("? SessionName "). If a session exists, true is returned. Otherwise, falseif (session ("? User ") {$ this-> assign (" user ", session (" user "));}
Then judge in the template
Logged-on html code
Unlogged html