Not sure what I am doing wrong (novice PHP)

[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]
In the commented out section there is a combined functionality of assigning a template block vars to ToggleAdmin if your package type is admin or superadmin. However I commented this out and tried to make it so that when someone is logged in as admin (separate class than superadmin) then I can assign a block var to ToggleAdmin and when someone is logged in as superadmin I can assign a block var to ToggleSuperAdmin.

Here is some sample template code to show you how this is called from the template:

[code]



	<!-- BEGIN ToggleLoggedIn -->
			
		<p>Welcome  to your resource center admin panel.  To access administration functions of the resource center (edit categories and resources) click on the "Administration" link in the top navigation menu.  Thank you.</p>
	<!-- END ToggleLoggedIn -->
	<!-- BEGIN ToggleAdmin -->
		<p>Test, this is to see if A works</p>
	<!-- END ToggleAdmin -->
	<!-- BEGIN ToggleSuperAdmin -->
		<p>Test, this is to see if SA works</p>
	<!-- END ToggleSuperAdmin -->
	<!-- BEGIN Personal -->
		<p>{Personal.firstname}</p>
	<!-- END Personal -->
</td>
<td valign="top" align="center" width="320"><br></b>
	<table align="center" width="310" cellpadding="0" cellspacing="0">
		<tr><td width="310">	
			<h1>FEATURED MCU NETWORK PARTNER</h1>	
			<table cellpadding="0" cellspacing="0">
				<tr><td width="135" align="center"><img src="../images/uep.jpg">
				</td>
				<td>
					<p>This is where a featured Network Parter description would go.  This section is capable of full HTML/CSS/PHP/Javascript formatting.</p>
				</td></tr>
			</table>
		</td></tr>
	</table>
</td></tr>
[/code]

As you can see the or should trigger one or the other to show up depending on which is active instead of both being active all the time. As of now they are both active all the time. I cannot get one to switch off when the other is active. What am I doing wrong?

You opened a new topic as a member, so I will lock this one.

Sponsor our Newsletter | Privacy Policy | Terms of Service