Author |
Message |
Acaria Board Member
Joined: 20 Feb 2009
Posts: 238
|
Posted: Fri Jul 03, 2009 5:17 pm Post subject: How do I make an ACP page? |
|
|
Okay, so I'm working on this online mod Sylver Cheetah asked for.
I've got everything working, except I can't figure out how to make an ACP page.
Can anyone help me out? All I really need is, like, a template to make a blank ACP page. I can probably figure it out myself from there. :3 |
|
Back to top |
|
|
Dog Cow Board Member
Joined: 18 Nov 2008
Posts: 378
|
Posted: Sun Jul 05, 2009 4:28 pm Post subject: Re: How do I make an ACP page? |
|
|
OK, here's a "skeleton" page which you need to fill in with some meat:
File: admin/admin_foo.php
(The name must start with admin_ for it to appear on the left nav bar.)
Code: |
<?php
// admin_foo.php
// Does foo and bar things...
// (c) for the world
define('IN_PHPBB', 1);
if( !empty($setmodules) )
{
$file = basename(__FILE__);
$module['General']['Foo_Bar'] = $file;
return;
}
//
// Let's set the root dir for phpBB
//
$phpbb_root_path = "./../";
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
////////// Everything thing above this line is required!!!! ///////////
//// The rest of this is like any other phpBB page ///////
$template->set_filenames(array(
"body" => "admin/foo_bar_body.tpl")
);
$template->assign_vars(array('FOO_BAR' => 'This is some foobar'));
$template->pparse("body");
////////// Special admin page_footer ///////////
include('./page_footer_admin.'.$phpEx);
?>
|
_________________ Moof!
Lincoln's Tomb, Oak Ridge Cemetery, Springfield IL • Mac 512K Blog • Mac GUI |
|
Back to top |
|
|
Ram Board Member
Joined: 23 Dec 2008
Posts: 100 Location: Somewhere over the rainbow
|
|
Back to top |
|
|
Acaria Board Member
Joined: 20 Feb 2009
Posts: 238
|
Posted: Sun Jul 05, 2009 5:47 pm Post subject: Re: How do I make an ACP page? |
|
|
Thank you both!
Now I have the Admin Page looking good. Just need to get the SQL to update. o 3o |
|
Back to top |
|
|
Acaria Board Member
Joined: 20 Feb 2009
Posts: 238
|
Posted: Mon Jul 06, 2009 1:29 am Post subject: Re: How do I make an ACP page? |
|
|
Okay, I'm having issues. Here's what I've got in the ACP page:
Code: |
//
// Something goes here, I know it...
//
if($action == "")
{
}
//
// But what goes there? D:
//
//
// Save the changes
//
if ($action == "change")
{
$location = '<a href="'.append_sid($file.'?action=settings').'" class="nav">Submitted Settings</a>';
//
// Time to execute these terrible, terrible SQLs
//
$sql = "UPDATE ".$table_prefix."config SET config_value = '".$newguestnum."' WHERE config_name = 'guest_add' ";
$sql = "UPDATE ".$table_prefix."config SET config_value = '".$newregnum."' WHERE config_name = 'reg_add' ";
$sql = "UPDATE ".$table_prefix."config SET config_value = '".$newhiddennum."' WHERE config_name = 'hidden_add' ";
}
//
// Done saving it
// |
And this is the TPL file:
Code: |
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td align="left"><span class="nav">{LOCATION}</span></td>
</tr>
</table>
<table width="99%" cellpadding="4" cellspacing="1" border="0" align="center" class="forumline">
<tr>
<th class="thHead" colspan="4">{L_USE_TITLE}</th>
</tr>
<tr>
<form action="change" method="post">
<td width="33%" class="row1" >Registered Users Added: <input type="text" name="newregnum" /></td>
<td width="33%" class="row1" >Hidden Users Added: <input type="text" name="newhiddennum" /></td>
<td width="33%" class="row1" >Guest Users Added: <input type="text" name="newguestnum" /></td>
<td width="100%" class="row1" ><span class="gen"><input type="hidden" name="action" value="change"><input type="submit" class="mainoption" value="Submit"></span></td>
</form>
</tr>
<br />
<br clear="all" />
|
When I click the "Submit" button, nothing changes.
I know something has to go in that main body page to define those input fields, but I'm totally lost now.
What would go there? |
|
Back to top |
|
|
Dog Cow Board Member
Joined: 18 Nov 2008
Posts: 378
|
Posted: Mon Jul 06, 2009 5:10 pm Post subject: Re: How do I make an ACP page? |
|
|
Acaria wrote: | Okay, I'm having issues. |
Here's the fixed version of your page:
Code: |
//
// Something goes here, I know it...
//
if($action == "")
{
}
//
// But what goes there? D:
//
//
// Save the changes
//
$action = (isset($HTTP_POST_VARS['action'])) ? $HTTP_POST_VARS['action'] : '';
$newregnum= (isset($HTTP_POST_VARS['newregnum'])) ? intval($HTTP_POST_VARS['newregnum']) : 0;
$newguestnum= (isset($HTTP_POST_VARS['newguestnum'])) ? intval($HTTP_POST_VARS['newguestnum']) : 0;
$newhiddennum= (isset($HTTP_POST_VARS['newhiddennum'])) ? intval($HTTP_POST_VARS['newhiddennum']) : 0;
if ($action == "change")
{
$location = '<a href="'.append_sid($file.'?action=settings').'" class="nav">Submitted Settings</a>';
//
// Time to execute these terrible, terrible SQLs
//
$sql = "UPDATE ".$table_prefix."config SET config_value = '".$newguestnum."' WHERE config_name = 'guest_add' ";
$sql = "UPDATE ".$table_prefix."config SET config_value = '".$newregnum."' WHERE config_name = 'reg_add' ";
$sql = "UPDATE ".$table_prefix."config SET config_value = '".$newhiddennum."' WHERE config_name = 'hidden_add' ";
}
//
// Done saving it
//
message_die(GENERAL_MESSAGE, 'Online users updated OK');
|
You will still need to add the $template lines, and include the footer. _________________ Moof!
Lincoln's Tomb, Oak Ridge Cemetery, Springfield IL • Mac 512K Blog • Mac GUI |
|
Back to top |
|
|
Sylver Cheetah 53 Board Member
Joined: 17 Dec 2008
Posts: 426 Location: Milky Way
|
Posted: Tue Jul 07, 2009 5:47 am Post subject: Re: How do I make an ACP page? |
|
|
I think it would be easyer to just add a line in General Configuration. _________________ Image link
My Forum || My Blog
phpBB2 forever! |
|
Back to top |
|
|
Dog Cow Board Member
Joined: 18 Nov 2008
Posts: 378
|
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Fri Aug 28, 2009 11:08 pm Post subject: Re: How do I make an ACP page? |
|
|
Know that if you do add something to the general config, the admin config page does not do inserts only updates. That got me for the first few times I created MODs that used the phpbb_config table...
You have to insert the value manually (using SQL or some php page) before the config page will be able to manage it. _________________ phpBBDoctor Blog |
|
Back to top |
|
|
Dog Cow Board Member
Joined: 18 Nov 2008
Posts: 378
|
|
Back to top |
|
|
|