Jump to content

Set visibility of span with PHP


NotSureILikePHP

Recommended Posts

I have a span that is only supposed to show if the user is an admin. The code works fine on the current system but I'm trying to upgrade to a newer system. Here is the code:

 

<div class="note ui-corner-top">
    <h4 class="ui-corner-top">
        <?=Format::daydatetime($note[created])?> -  posted by <?=$note[staff]?>
        <span id='link_<?=$note[noteID]?>' style='float:right;padding-right:10px;'>
        <span id='sEdit'><a href='javascript:makeEditable("<?=$note[noteID]?>", "Edit", "customer_note")'>Edit</a></span>
        <?if($thisstaff->isAdmin()){?>
            <span id='sDelete'> \ <a href='javascript:makeEditable("<?=$note[noteID]?>", "Delete", "customer_note")'>Delete</a></span>
            <?}?>
            <span id='customer_note_save_link_<?=$note[noteID]?>' style='display:none'><a href='javascript:makeEditable("<?=$note[noteID]?>", "Save", "customer_note")'>Save</a></span>  
            <span id='customer_note_cancel_link_<?=$note[noteID]?>' style='display:none'> \ <a href='javascript:makeEditable("<?=$note[noteID]?>", "Cancel", "customer_note")'>Cancel</a> 

            < /span>
        </span>
    </h4>
</div>

[/]

 

This is displaying "Edit isAdmin()){?> \ Delete"

 

When I delete this line of code:

 

[code]

<?if($thisstaff->isAdmin()){?>

[/]

 

I get "Edit / Delete" which is exactly what I want but then it always displays even when the user isn't an admin. I'm assuming I'm missing something very simple here, like an apostrophe or something but I can't figure it out.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.