Page 1 of 1

php and html

Posted: Mon Jan 28, 2008 10:23 am
by highjo
Hello guys! i really don't know if this topic was discussed before but i haven't got any rsult from the search.I'm tring to build a control panel which will be use by differents persons gategorised by thier group id in the database.ok.In the panel i created all the tool links necessary to manage the site.But then i entend t hide some links that some people with low privilige shouldn't see.
here is my codes

Code: Select all

 
 
<?php
 if ($_SESSION['MM_UserGroup']==2) {
    
 
        echo "<script language='javascript'>";
        echo "document.getElementById('createarticle').style.display='none'; ";
        echo "document.getElementById('articlesindex').style.visibility='hidden'; ";
        echo "document.getElementById('valider').style.visibility='hidden'; ";
        echo "document.getElementById('corbeille').style.visibility='hidden'; ";
        echo "document.getElementById('configglobale').style.visibility='hidden'; ";
        echo    "</script>";
            
 }
?>
 
i named the div tag by id but nothing is happenning for people of group id 2.If there is a better idea please let me know or help me make this work please. thanks

Re: php and html

Posted: Mon Jan 28, 2008 12:37 pm
by Christopher
Probably better than hiding the divs would be to only add them to the page by putting if()'s around the HTML.

It this Javascript in the body or head of the document?

Re: php and html

Posted: Tue Jan 29, 2008 7:49 am
by highjo
I put the javascript first in the head but realising it's not working i put it finally on th first line of the body.

Re: php and html

Posted: Tue Jan 29, 2008 8:06 am
by Ollie Saunders
Probably better than hiding the divs would be to only add them to the page by putting if()'s around the HTML.
Agreed.