Anyone got any tips on creating a simple ACP?

Discussion forum for MOD Writers regarding MOD Development.
Locked
Ragman
Registered User
Posts: 71
Joined: Wed Dec 08, 2004 7:06 pm

Anyone got any tips on creating a simple ACP?

Post by Ragman »

Just looking for any tips/tricks/info on how to create an admin control panel for my mod.
Was hoping someone here would have some good advice on how to go about setting up an ACP. Even just a very basic and simple set up is something to get me started on how it works.

If anyone has any links to tutorials, or some general info, or anything that would help, i'd greatly appreciate it.

Thanks very much
wGEric
Former Team Member
Posts: 8805
Joined: Sun Oct 13, 2002 3:01 am
Location: Friday
Name: Eric Faerber
Contact:

Re: Anyone got any tips on creating a simple ACP?

Post by wGEric »

http://www.phpbb.com/mods/documentation ... /index.php

If you need more help, don't hesitate to ask.
Eric
Ragman
Registered User
Posts: 71
Joined: Wed Dec 08, 2004 7:06 pm

Re: Anyone got any tips on creating a simple ACP?

Post by Ragman »

wGEric wrote:http://www.phpbb.com/mods/documentation ... /index.php

If you need more help, don't hesitate to ask.
cheers mate. i appreciate that.
Ragman
Registered User
Posts: 71
Joined: Wed Dec 08, 2004 7:06 pm

Re: Anyone got any tips on creating a simple ACP?

Post by Ragman »

ok i must be doing something wrong. ;)

I tried to follow that simple example in the documentation you linked me to.
However, i can't seem to get it to show up in the Modules section regardless of what i do.

Or is it not supposed to show up, since it's just an example?
User avatar
blueray2048
Registered User
Posts: 324
Joined: Mon Sep 25, 2006 5:20 pm
Contact:

Re: Anyone got any tips on creating a simple ACP?

Post by blueray2048 »

Hi, you may try this.

After you have followed the example created your first sample ACP Module.
Don't forget to create an addition `Category` that was used to hold the module.
or place it on existing Category.

Code: Select all

Because ACP module was Category => Category => Module
Take the Posting Tab (It is the first Category) for example.
It have two more Category Messages and Attachments ( The Second Category )

To create a new Category on Posting Tab.
  • Select the system, and then, Administration Control Panel
  • On the module management Section, click the Posting link.
  • A new screen displayed with the above metioned Category.
  • Type a new Category name in the text box to the right side of the button `Create new module` and click it.
5.) Fill the following info:

Code: Select all

Module language name: MyMod or language entry
Module type: Category
Parents: Posting
If all this is fine. Follow the mod documentation to add a module to the new category.

Wish this help.
Ragman
Registered User
Posts: 71
Joined: Wed Dec 08, 2004 7:06 pm

Re: Anyone got any tips on creating a simple ACP?

Post by Ragman »

Hi, thanks for the assistance.
However, this part i'd managed to get to. But the new module doesn't show up in the Posting tab if i add it to that, even though when i added the module to the MyMod posting category, it was recognised there just fine as ACP_FOO

It just doesn't seem to want to show up when i click on the Posting tab. :(
User avatar
blueray2048
Registered User
Posts: 324
Joined: Mon Sep 25, 2006 5:20 pm
Contact:

Re: Anyone got any tips on creating a simple ACP?

Post by blueray2048 »

Did you module showup already but not with descriptive title ?
If So, please check out this tip http://www.phpbb.com/mods/documentation ... /index.php
Tip
While you can use your own language file in the module, the title/name will have to go into a default language file (for instance, /acp/common/).
As this on /acp/common/common.php

Code: Select all

$lang = array_merge($lang, array(
	'ACP_ADMINISTRATORS'		=> 'Administrators',
....
	'TEST_MODE1' => 'Database table Admin',
	'TEST_MODE2' => 'Control Panels',
	'TEST_MODE3' => 'Backups')
	);
and you have to add the new module to the Posting -> MyMod

Image
Wish this help
Ragman
Registered User
Posts: 71
Joined: Wed Dec 08, 2004 7:06 pm

Re: Anyone got any tips on creating a simple ACP?

Post by Ragman »

the module shows up. that's not the problem.
But it does not show in the left hand nav menu of the category i put it in. There's nothing to click on, etc.

This is probably something extremely easy to everyone else, i just don't get it :( And it's very frustrating hehe.

Maybe an easier way for me to understand is if someone would be so kind as to write a stupidly simple ACP module that i could use as an example. As the example that's on that page just doesn't seem to do anything.

Plus i don't understand what it means in that tip of:
While you can use your own language file in the module, the title/name will have to go into a default language file (for instance, /acp/common/).
What does it mean "the title/name will have to go into a default language file"?
Title/name of what?
User avatar
blueray2048
Registered User
Posts: 324
Joined: Mon Sep 25, 2006 5:20 pm
Contact:

Re: Anyone got any tips on creating a simple ACP?

Post by blueray2048 »

Enabled the category and module ?

And check this example to see if it is help.

This is a sample module class info take from phpBB Module Documentation.

Code: Select all

class acp_hello_world_info
{
	function module()
	{
	return array(
		'filename'	=> 'acp_hello_world',
		'title'		=> 'ACP_HELLO_WORLD',
		'version'	=> '1.0.0',
		'modes'		=> array(
			'hello_user'		=> array('title' => 'HELLO_USER', 'auth' => 'acl_a_user', 'cat' => array('ACP_AUTOMATION')),
			'hello_world'		=> array('title' => 'HELLO_WORLD', 'auth' => 'acl_a_group', 'cat' => array('ACP_AUTOMATION')),
			'hello_bertie'		=> array('title' => 'HELLO_BERTIE', 'auth' => 'acl_a_board && acl_a_server', 'cat' => array('ACP_AUTOMATION')),
			),
		);
		
	}
}
This is $phpbb_root_path/language/en/acp/common.php

Code: Select all

$lang = array_merge($lang, array(
	'HELLO_USER' => 'TestMod #1',
	'HELLO_WORLD' => 'Control Panels',
	'HELLO_BERTIE' => 'Backups')
	);

Check the description also:
The Mods directory is a good place to store those files. However, note that the language entries for module and mode titles needs to be placed in one of the default language files to take effect.

title
The title to use in the module management. This should match an existing language entry.

auth
The permissions required to see/use the mode. This can use logical operators and are always prefixed with acl_. So, a_modules will be written as acl_a_modules. Furthermore, configuration items can be obtained too, by prefixing them with cfg_. (add link to a more comprehensive explanation of what is possible with the field, additionally explaining the use of aclf, forum ids, etc.)

cat
The default category of the mode
Ragman
Registered User
Posts: 71
Joined: Wed Dec 08, 2004 7:06 pm

Re: Anyone got any tips on creating a simple ACP?

Post by Ragman »

yeah, the example from the documentation isn't helpful at all.
I've not been able to get it working regardless of what i do with it.

I figured an easier way to do it. I'm just going to get someone elses ACP mod and pick it apart to figure out what each portion does. There's got to be some simple mods out there that add ACP modules.
WebSnail
Registered User
Posts: 524
Joined: Sun Nov 11, 2001 2:20 pm
Location: South Yorkshire, UK
Contact:

Re: Anyone got any tips on creating a simple ACP?

Post by WebSnail »

The documentation is pretty good but if I had one wish it would be for a walk through guide which I suspect I'll end up writing if I ever figure it all out :). At the moment it's easy to miss important information because it's hidden in a lot of text.

Couple of nuggets I learned today though.

Create a Module Category
This isn't very clear in the docs but is if you actually look at the tip info in the actual form. You should use your language key (the use of the term "constant" is misleading.. it's an array key, not a constant!) eg: if you've defined 'MY_NEW_MODULE_CATEGORY' => 'My new Mod category' you should input the key "MY_NEW_MODULE_CATEGORY" (without quotes) and the system will automatically grab the translated term for you.

Create a sub-category to your main category
This one had me scratching my head for a while before I remembered something I'd read earlier. In order for you to get a category on the tab and then get your modules to appear in the left bar you must create a sub-category with your original category as parent. You then make your modules with parent of your sub-category.

Module titles
This has been described above but there's a couple of hiccups waiting in the system..
1. Eclipse will scream blue murder if you attempt to edit your language/en/acp/common.php file because it can't cope with the typeset (I found ultraedit coped fine). I suspect because of certain characters you could end up breaking the file.
2. The instructions are very vague on where exactly you should put your titles language array. For me, I'm using common.php but it'd sure be useful to create a seperate file called "mods.php" instead to avoid confusion.


Note: I've already seen the Karma mod ignore the mod guidelines re:language files completely and just shove the language file in language/en/ (not in mods!) so be careful which mods you use as references as they could be leading you to the "Dark side(tm)" of coding ;)
Locked

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