Recent Topics

GetHandledDispModes() Help please

Started by on Nov 10, 2013 – Contents updated: Nov 11, 2013

Nov 10, 2013 11:21    

Can you please point me to where the manual provides info on how to use this? or give me direction.
this is what I have:

PHP

/**
     * Return list of custom disp types handled by this plugin
     *
     * @return array list of disp modes handled by this plugin
     */
    function GetHandledDispModes()
    {
        return array(
                'disp_test'// display our test disp
            );
    }
 
 
    /**
     * Display our custom disp mode(s)
     *
     * @param mixed array $params
     *         disp > display mode requested
     *
     * @return did we display?
     */
    function HandleDispMode$params )
    {
        echo '<p>This is the test plugin handling the ['.$params['disp'].'] disp mode.</p>';
    }

this is how I implemented it:

PHP

/**
     * Return list of custom disp types handled by this plugin
     *
     * @return array list of disp modes handled by this plugin
     */
    function GetHandledDispModes()
    {
        return array(
                'disp_test'// display our test disp
            );
    }
 
 
    /**
     * Display our custom disp mode(s)
     *
     * @param mixed array $params
     *         disp > display mode requested
     *
     * @return did we display?
     */
    function HandleDispMode$params )
    {
        include '_test.disp.php';
    }

surely there is a better way of doing this?

Nov 11, 2013 22:17

PHP

function GetHandledDispModes()
{
    return array(
            'info',
        );
}
 
 
function HandleDispMode$params )
{
    if( $params['disp'] == 'info' )
    {
        echo 'My Info page';
    }
}

View your info page

Code

http://b2evoblog/?disp=info

Nov 11, 2013 22:37

Thanks, I got that. What I actually want is to point it to the disp file:

PHP

//_test.disp.php

the only way I get it to to work is with

PHP

include '_test.disp.php';

shouldn't it instead be something like:

PHP

$disp_handlers array'disp_test' => '_test.disp.php',  );

Nov 11, 2013 23:27

SOLVED:
copy _test.disp.php to skins folder:

PHP

function GetHandledDispModes()
    {
        return array(
                'disp_test'  // display our test disp
            );
 
    }
 
 
 
    
    function HandleDispMode$params )
    {
        
        return skin_include'$disp$'array(
           'disp_test'  => '_test.disp.php',
         ) );
    }

Thanks @mgsolipa and @sam2kb


Form is loading...

powered by b2evolution free blog software – This forum is powered by b2evolution CMS, a complete engine for your website.