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
https://forums.phpfreaks.com/topic/297666-set-visibility-of-span-with-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.