Topic: [1.3] Simple configuration for extensions

There is any possibility of an automatic configuration page with pairs name/value to be written in "config" table ?

I'm thinking something like this (view code) in manifest.xml, for simple extensions. More complex extensions should be generate their own configuration page.

<configuration>
   <description><![CDATA[
echo 'This extension blah blah blah'
   ]]></description>
   <input name="name1" text="Name 1" require="require" />
   <input name="name2" text="Name 2" />
</configuration>

Sorry for my english tongue

sorry for my english

Re: [1.3] Simple configuration for extensions

There should be an install section in which you can just execute queries. I don't see how exactly this would be useful.

Re: [1.3] Simple configuration for extensions

Mmm, probably not. There are several issues involved, I'll list a couple I just thought of:
- Where should the link(s) to such a page be put?
- What should the page look like?
- How would input be validated on submit? How would developers choose radio/checkbox/inbox box/textarea?
- What would be the naming scheme for such variables in $pun_config? Would there be potential issues with overwriting existing options?

Basically, adding such a page would make the extension manifest fairly complex and require us to add a lot of code. It's much easier to let the developers who need such functionality implement as much of it as they need.

As Bekko said, there is also an install section to allow extension writers to add config variables (as well as an uninstall section for removing them).

Re: [1.3] Simple configuration for extensions

sad Ok, let me refrase the question...
I have an extension who needs 2 values setting by user (the default value is set by extension, with install/uninstall feature, of course).

Where is the best place to put such configuration page ?

sorry for my english

Re: [1.3] Simple configuration for extensions

Well, I should start off by saying that since all of the hooks aren't in and the beta hasn't been released, now is not the best time to start developing extensions. In fact, I would discourage it as a general rule, especially because there are no hooks in the administration section yet wink
If you think you need your own configuration page, you can write one. If you want to add it to an existing page in admin/options.php, you'll be able to once we put hooks there.

6

Re: [1.3] Simple configuration for extensions

Basics on http://punbb.org/update/manifest/hotfix_13svn_test.xml i wrote small extension which add link to options section

<?xml version="1.0" encoding="utf-8"?>

<extension engine="1.0">
    <id>test</id>
    <title>Example</title>
    <version>1.0</version>
    <description>ble ble.</description>
    <author>Daris</author>
    <minversion>1.3</minversion>
    <maxtestedon>1.3</maxtestedon>
    <note type="install" timing="pre">example</note>
    
    <hooks>
        <hook id="ca_admin_menu_new_sublink"><![CDATA[
            include('../extensions/test/test.php');
        ]]></hook>
    </hooks>
</extension>

and test.php

<?        
if (PUN_PAGE_SECTION == 'options')
    $adnav_sublinks[] = '<li><a href="../extensions/test/test.php">Test ext</a></li>';
?>

Sorry for my English, it's very poor tongue

Re: [1.3] Simple configuration for extensions

That hook was not there at the time I wrote the post, it was added in the past 24 hours. There is also no guarantee that we won't decide to change the name of that hook between now and the beta. Finally, it doesn't change the fact that there are not yet any hooks within the admin pages themselves where you could add inputs for new config values easily. wink