Hey guys,
I’m pretty new to PHP, but I guess that’s OK here. I have wanted to learn PHP and MySQL for quite some time and I have taken a few classes about both but I am just getting into the coding part for real. So I am glad to have a place where I won’t be made fun of (unlike some others who will remain nameless because I’m better than that).
I want to learn because I am tired of losing good programmers that work for me to other projects or any other thing that comes along. I want to start something and finish it. So here I am. Sorry for the intro…
Today I am working with one of the projects that my last programmer left for me. It is a simple CMS system that is a hybrid of various open source php scripts and I had him create it for me to allow me to do some advanced website creation using interactivity (backoffice functions) on sites that needed it. It contains a newsletter module, an ecommerce module, a profile module, a registration module, etc. However, now that I do not have access to this programmer any longer I have to do what I can myself.
Today’s problem involves one of the functions of this CMS that because I do not know PHP as well as I will if I keep at it I am not finding the answer. This CMS designates users according to packages that can be created in an admin panel function and once created are global package types that can be referred to in order to designate display functionality of content dependent upon what user package type is logged in. The previous developer created a script that sits in my index.php file which combines the admin and superadmin package types into using a single designator of ToggleAdmin to toggle an active section of the webpage for that custom content. What I want it to do is to separate out admin from superadmin and have two separate terms that allow for one OR the other and not both to be active in a single session (because only one user package type can be logged in at one time. However when I tried to create a version of code that I thought should do the trick all I ended up doing was getting both active at the same time. So obviously I was not doing something correctly.
Here is the code. You will notice that the combined functionality code is commented out and my attempt is not commented out.
[php] if (empty($_SESSION[‘user’])) {
$template->assign_block_vars(‘ToggleNotLoggedIn’, array());
} else {
$template->assign_block_vars(‘ToggleLoggedIn’, array());
}
// if ($GLOBALS[‘ActiveUser’][‘packagedata’][‘admin’] || $GLOBALS[‘ActiveUser’][‘packagedata’][‘superadmin’]) {
// $template->assign_block_vars(‘ToggleAdmin’, array());
// }
if ($GLOBALS[‘ActiveUser’][‘packagedata’][‘admin’]) {
$template->assign_block_vars(‘ToggleAdmin’, array());
}
if ($GLOBALS[‘ActiveUser’][‘packagedata’][‘superadmin’]) {
$template->assign_block_vars(‘ToggleSuperAdmin’, array());
}[/php]
Here is the HTML that places it on the actual webpage so you can see the toggle function at work:
[code]
|
Can you look this over and let me know what I am doing wrong? All I want is for one or the other to be active at a time and to be able to create other package designations based upon other package types that will be created in the future, hopefully be me
Thanks a million and I look forward to haunting the place and getting to know you all and most of all finally getting better at PHP and MySQl and starting my dream of taking my ideas from conception to reality without always losing my coder because I will be the coder!
Benjamin