开发者

What does this code mean in plain english?

开发者 https://www.devze.com 2023-01-23 15:07 出处:网络
{if $GLOBALS.current_user.group.id != \"Employer\"} <li><a href=\"{$GLOBALS.site_url}/find_jobs/\" >[[Find Jobs]]</a></li>
{if $GLOBALS.current_user.group.id != "Employer"}
        <li><a href="{$GLOBALS.site_url}/find_jobs/" >[[Find Jobs]]</a></li>
        <li class="sep"></li>
        <li><a href="{$GLOBALS.site_url}/add_listing/?listin开发者_Go百科g_type_id=Resume" >[[Post     Resumes]]</a></li>
        <li class="sep"></li>
    {/if}

Just trying to figure out this code. I think it is saying "If the current user IS? or ISN'T? a member or the group 'employer' put the following links in..."

Which is it?

Thanks


!= means is not equal to, the exclamation point (!) is a negation operator:

$a = 5;

if ($a == 5) {
   // executed if condition is true
}

if ($a != 5) {
   // executed if condition is not true
}


!= means "not equals", so "If the current user ISN'T an employer..."


"isn't" (because of the !=)


I suppose this is in some sort of templating language? That isn't what normal PHP looks like. In any case, the != definitely means IS NOT, so it means if the current user IS NOT an employer, insert the links.


!= not equal thus if they are not group.id employer then put in the list items and anchor tags


If the id is not equal to "Employer", then condition is satisfied, process inner block which appears to be adding <li>'s to the page


Weird code. But it means Show this html elements if group of current user IS NOT Employer.

0

精彩评论

暂无评论...
验证码 换一张
取 消