1 (edited by Lamonte 2008-03-03 14:10)

Topic: Been messing around with extensions....

And I noticed some things.  Like you can break up conditionals when trying to do a check.

e.g.::pseudo

<hook>
<![CDATA[
if( 1 > 0 )
{
echo 'yep';
}
else
{
]]>
</hook>
<hook>
<![CDATA[
echo 'nope';
}
]]>
</hook>

The code would break in the eval() function, ah well.

Was messing around with my extension "Custom Pages"

http://ex-code.info/pbb13/index.php?action=testpage

<?xml version="1.0" encoding="utf-8"?>
<extension engine="1.0">
    <id>custom_index_page</id>
    <title>Custom Index Pages</title>
    <version>1.0.1</version>
    <description>Be able to create a new page with ease</description>
    <author>Lamonte Harris</author>
    <minversion>1.3 Beta</minversion>
    <maxtestedon>1.3 Beta</maxtestedon>
    <hooks>
        <hook id="in_qr_get_cats_and_forums">
        <![CDATA[
        $pages = array('testpage');
        if( isset($_GET['action']) AND in_array($_GET['action'],$pages) )
        {
            $page = $_GET['action'];
            if( in_array($page,$pages))
            {
                require_once(PUN_ROOT.'extensions/custom_index_page/' . $page . '.php');
            }
            require PUN_ROOT.'footer.php';
            exit;
        }
        ]]>
        </hook>
    </hooks>
</extension>

Re: Been messing around with extensions....

I'm confused. Yes, it's up to you to write valid PHP code. Is there something here I'm missing?

Re: Been messing around with extensions....

That you can't, for example, put a block between two hooks in a conditional.

Re: Been messing around with extensions....

That's pretty normal I believe.

Re: Been messing around with extensions....

Yes, but also pretty annoying tongue

Re: Been messing around with extensions....

Oh, I see now. Yes, this isn't the same thing as splicing your code in, just like you can't do that using includes. Each hook has to be valid PHP in and of itself.
And there shouldn't be any reason to need to do it that way anyway.

Re: Been messing around with extensions....

Was just messing with the code.  Might clear "information" up for others tongue

8

Re: Been messing around with extensions....

An extension could create its own hooks right though? Then you could extend an extension, which would be good for big ones like PMs etc.

It could do with an ability to set dependencies in the manifest.xml although your own install script could detect them.