How to make ACP Modules (Demonstration)

How-to's, little tricks, tutorials, code examples (snippets) and read-me's.

How to make ACP Modules (Demonstration)

Postby geoffreak » 21 May 2007, 22:54

Sample ACP Module
Main class
(includes/acp/acp_foo.php)
Code: Select all
class acp_foo
{
   var 
$u_action;
   var 
$new_config;
   function 
main($id$mode)
   {
      global 
$db$user$auth$template;
      global 
$config$phpbb_root_path$phpbb_admin_path$phpEx;
      
$user->add_lang('mods/foo');
      switch(
$mode)
      {
         case 
'index':
            
$this->page_title 'ACP_FOO';
            
$this->tpl_name 'acp_foo';
            break;
      }

   }

Info Class
(includes/acp/info/acp_foo.php)
Code: Select all
class acp_foo_info
{
    function 
module()
    {
        return array(
            
'filename'    => 'acp_foo',
            
'title'        => 'ACP_FOO',
            
'version'    => '1.2.3',
            
'modes'        => array(
                
'index'        => array('title' => 'ACP_FOO_INDEX_TITLE''auth' => 'acp_foo_auth''cat' => array('')),
            ),
        );
    }

    function 
install()
    {
    }

    function 
uninstall()
    {
    }

Language File
(language/en/mods/foo.php)
Code: Select all
/**
* DO NOT CHANGE
*/
if (empty($lang) || !is_array($lang))
{
    
$lang = array();
}
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine

$lang array_merge($lang, array(
    
'ACP_FOO_INDEX_TITLE'                        => 'Foo Index',
)); 

Sample Style HTML
(adm/style/acp_foo.html)
Code: Select all
<!-- INCLUDE overall_header.html -->

Hello, World!

<!-- INCLUDE overall_footer.html -->
Earthlings, we have been watching you for years, and now we know your primitive language, so listen: All your base are belong to us.
Anime Bite - Your future #1 source for all things anime and manga!My Blog
User avatar
geoffreak    
Supporter
Supporter
 
Posts: 663
Joined: 17 Mar 2007, 21:52
Location: The Internets
Favorite Team: phpBB
Gender: Male
phpBB Knowledge: 9


Re: How to make ACP Modules (Demonstration)

Postby zachpl » 22 May 2007, 06:52

Cool mb you can show a picture of what it looks like after it is done.
Sniper_E wrote:I speak French.... wee wee
zachpl
Beta Tester
Beta Tester
 
Posts: 195
Joined: 13 Apr 2007, 14:57
Favorite Team: Gaints
Gender: Male

Re: How to make ACP Modules (Demonstration)

Postby Handyman » 22 May 2007, 08:31

zachpl wrote:Cool mb you can show a picture of what it looks like after it is done.

when its done, it looks just like any other ACP module? so take a peek in the ACP to see what it looks like when it's done ;)
Please contact me if you have any news to submit to SCOFF News.
SCOFFing at the candidates while you sleep.
My Mods || My Mod Queue
Image
User avatar
Handyman    
Rear Fleet Admiral
Rear Fleet Admiral
 
Posts: 7456
Joined: 08 May 2006, 04:45
Location: Where no man has gone before!
Favorite Team: Seattle Seahawks
Gender: Male

Re: How to make ACP Modules (Demonstration)

Postby zachpl » 22 May 2007, 08:59

Ok sry
Sniper_E wrote:I speak French.... wee wee
zachpl
Beta Tester
Beta Tester
 
Posts: 195
Joined: 13 Apr 2007, 14:57
Favorite Team: Gaints
Gender: Male

Re: How to make ACP Modules (Demonstration)

Postby green genie » 01 Jul 2007, 18:55

Did you copy this from naderman's wiki? Because I see the same mistake I corrected on his site yesterday.

Code: Select all
      $user->add_lang('mods/foo').


should be
Code: Select all
      $user->add_lang('mods/foo');
green genie
Crewman
Crewman
 
Posts: 9
Joined: 27 Jun 2007, 18:06
Gender: Male

Re: How to make ACP Modules (Demonstration)

Postby harmlessgoat22 » 26 Jul 2007, 10:46

I got a *ahem* slight *ahem* error while trying this...

Code: Select all
Parse error: parse error, unexpected ')' in C:Documents and SettingsDavewampwwwdemo020includesfunctions_module.php(317) : eval()'d code on line 1

Parse error: parse error, unexpected ')' in C:\Documents and Settings\Dave\wamp\www\demo020\includes\functions_module.php(317) : eval()'d code on line 1
[phpBB Debug] PHP Notice: in file /adm/index.php on line 153: Cannot modify header information - headers already sent by (output started at /includes/functions_module.php(317) : eval()'d code:1)
[phpBB Debug] PHP Notice: in file /adm/index.php on line 155: Cannot modify header information - headers already sent by (output started at /includes/functions_module.php(317) : eval()'d code:1)
[phpBB Debug] PHP Notice: in file /adm/index.php on line 156: Cannot modify header information - headers already sent by (output started at /includes/functions_module.php(317) : eval()'d code:1)
[phpBB Debug] PHP Notice: in file /adm/index.php on line 157: Cannot modify header information - headers already sent by (output started at /includes/functions_module.php(317) : eval()'d code:1) 
User avatar
harmlessgoat22    
STG Support Team
STG Support Team
 
Posts: 2886
Joined: 13 Jul 2006, 17:38
Gender: Male
phpBB Knowledge: 8

Re: How to make ACP Modules (Demonstration)

Postby harmlessgoat22 » 26 Jul 2007, 11:42

OK, I got the error to go away, but no matter where I place it in the ACP, it won't show up. Not a link to the page...nothing!

EDIT:
I GOT IT FIGURED OUT ALL BY MYSELF!!! WITH NO HELP FROM YOU GUYS!!! I WISH THERE WAS A TICKED OFF SMILIE RIGHT NOW!!!! SINCE THERE ISN'T, I'LL HAVE TO SETTLE FOR THIS...




:P
Just because you guys are absolutely no help to me ;) , doesn't mean you're not still cool :cool: (the wink means that you are very helpful to me :D )
User avatar
harmlessgoat22    
STG Support Team
STG Support Team
 
Posts: 2886
Joined: 13 Jul 2006, 17:38
Gender: Male
phpBB Knowledge: 8

Re: How to make ACP Modules (Demonstration)

Postby Jaymie1989 » 27 May 2008, 08:00

Help Guys :beg:

I aint changed any of the names in the files iv just saved them as they are and placed them in there correct locations and iv got this error.
class acp_foo_info { function module() { return array( 'filename' => 'acp_foo', 'title' => 'ACP_FOO', 'version' => '1.2.3', 'modes' => array( 'index' => array('title' => 'ACP_FOO_INDEX_TITLE', 'auth' => 'acp_foo_auth', 'cat' => array('')), ), ); } function install() { } function uninstall() { } } [phpBB Debug] PHP Notice: in file /adm/index.php on line 159: Cannot modify header information - headers already sent by (output started at /includes/acp/info/acp_foo.php:15)
[phpBB Debug] PHP Notice: in file /adm/index.php on line 161: Cannot modify header information - headers already sent by (output started at /includes/acp/info/acp_foo.php:15)
[phpBB Debug] PHP Notice: in file /adm/index.php on line 162: Cannot modify header information - headers already sent by (output started at /includes/acp/info/acp_foo.php:15)
[phpBB Debug] PHP Notice: in file /adm/index.php on line 163: Cannot modify header information - headers already sent by (output started at /includes/acp/info/acp_foo.php:15)
Jaymie1989    
Supporter
Supporter
 
Posts: 1370
Joined: 30 Sep 2007, 15:51
Location: Some where in phpbb_users table
Favorite Team: Liverpool FC
Gender: Male
phpBB Knowledge: 5

Re: How to make ACP Modules (Demonstration)

Postby Erik Frèrejean » 27 May 2008, 09:48

I think that you forgot to open (<?php) and close (?>) the php part. Check whether your code is enclosed by these tags. If so can you post the content of your file?
Image Proud member of the phpBB support team
Image STG Support team member | Image STG Moderator team member
Image
User avatar
Erik Frèrejean    
phpBB Team Member
phpBB Team Member
 
Posts: 1114
Joined: 03 Dec 2007, 00:49
Location: USERS_TABLE
Favorite Team: New Orleans Saints
Gender: Male
phpBB Knowledge: 10

Re: How to make ACP Modules (Demonstration)

Postby Jaymie1989 » 27 May 2008, 10:00

Ok, I got past that part.

I have added the page to the category but now i get this error when i click on yes to add it.

Parse error: syntax error, unexpected ')' in C:\xampp\htdocs\forum\includes\functions_module.php(328) : eval()'d code on line 1

Parse error: syntax error, unexpected ')' in C:\xampp\htdocs\forum\includes\functions_module.php(328) : eval()'d code on line 1
[phpBB Debug] PHP Notice: in file /adm/index.php on line 159: Cannot modify header information - headers already sent by (output started at /includes/functions_module.php(328) : eval()'d code:1)
[phpBB Debug] PHP Notice: in file /adm/index.php on line 161: Cannot modify header information - headers already sent by (output started at /includes/functions_module.php(328) : eval()'d code:1)
[phpBB Debug] PHP Notice: in file /adm/index.php on line 162: Cannot modify header information - headers already sent by (output started at /includes/functions_module.php(328) : eval()'d code:1)
[phpBB Debug] PHP Notice: in file /adm/index.php on line 163: Cannot modify header information - headers already sent by (output started at /includes/functions_module.php(328) : eval()'d code:1)
Jaymie1989    
Supporter
Supporter
 
Posts: 1370
Joined: 30 Sep 2007, 15:51
Location: Some where in phpbb_users table
Favorite Team: Liverpool FC
Gender: Male
phpBB Knowledge: 5

Next

Return to Tutorials and How-Tos

Who is online

Users browsing this forum: No registered users and 5 guests