Help Understanding some basic ACP php-script

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
odo324
Registered User
Posts: 39
Joined: Tue May 13, 2003 6:38 am

Help Understanding some basic ACP php-script

Post by odo324 »

There are 2 things in various Admin Pages that I am really confused about. I don't want to fudge up my Admin Panel (that I started today) so any explanation will be greatly appreciated!


[1] :arrow: I see this:

Code: Select all

if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
	$mode = ($HTTP_GET_VARS['mode']) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
}
else
{
	if( isset($HTTP_POST_VARS['add']) )
		$mode = "add";
	else if( isset($HTTP_POST_VARS['save']) )
		$mode = "save";
	else
		$mode = "";
}
...in some of the ACP pages I've looked at. I'd guess this has to do with submitting data to PhpBB, but how do I use it? Is it recommended?

My admin page will have it's own set of 'modes' (ex: $mode['categories'], $mode['groups']) that effect what is being displayed/edited on the page. I'll tack this on the end of a 'return' URL like " append_sid('admin_file.' . $phpEx . '?cat=' . $variable )". Will this interfere?


[2] :arrow: I also see:

Code: Select all

if( !empty($setmodules) )
{
   $file = basename(__FILE__);
   $module[$lang['stuff']][$lang['stuff_more']] = "$file";
   return;
}
...now and again. So what's the "$module" and "$setmodules" variables all about?

User avatar
AsAf92
Registered User
Posts: 102
Joined: Tue Jan 06, 2004 1:57 pm

Post by AsAf92 »

The first question:
it's the mode of the page.
like in profile.php, it used to register, view profile, edit profile...
so the mode variable is telling if it's to register, view profile, etc....

netclectic
Former Team Member
Posts: 4439
Joined: Wed Mar 13, 2002 3:08 pm
Location: Omnipresent
Contact:

Post by netclectic »

if this is your own page then you can use $mode anyway you like, you're not going to break any other pages.

the $modules stuff tells the ACP where you page will appear in the menu.

Code: Select all

if( !empty($setmodules) )
{
   $file = basename(__FILE__);
   $module['My Menu Section']['My Page'] = "$file";
   return;
}
this would create a new section with a link to your page, to add your page to an exisiting menu section then just change 'My Menu Section' to the name of an exisiting menu section.
Defend the game:
Image

odo324
Registered User
Posts: 39
Joined: Tue May 13, 2003 6:38 am

Post by odo324 »

Cool, thanks! :)

Post Reply

Return to “[2.0.x] MOD Writers Discussion”