Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
pnHTML / theme trick
  • Posted: 31.05.2003, 04:47
     
    Clanmaster
    rank:
    Freshman Freshman
    registered:
     April 2003
    Status:
    offline
    last visit:
    30.07.04
    Posts:
    49
    I have noticed that when using strict pnHTML compliancy in the development of a module, sometimes the end result is that the background of the client area makes things hard to read when the output is written to the screen. In addition, some people wish to put all thier content into a theme compatible "box". This used to done through the theme's OpenTable/CloseTable functions. Here is one way to enable either/or at the admin level.

    1) Create an integer based module var for your module such as "wrapmode" and the appropriate controls to your admin screen where the var takes the following values:

    0 = Use None
    1 = Use OpenTable() / CloseTable()
    2 = Use OpenTable2() / CloseTable2()
    3 = Use Both

    2) Build your modules output as always, using the pnHTML ojbject.

    3) Change the last few lines of any function that writes to the screen like this:

    [php:1:8c581c6569]
    $wrapmode = pnModGetVar('modname', 'wrapmode');

    switch($wrapmode){
    case 1:

    include('header.php');
    OpenTable();
    echo $output->GetOutput();
    CloseTable();
    include('footer.php');
    return true;
    break;

    case 2:

    include('header.php');
    OpenTable2();
    echo $output->GetOutput();
    CloseTable2();
    include('footer.php');
    return true;
    break;

    case 3:

    include('header.php');
    OpenTable();
    OpenTable2();
    echo $output->GetOutput();
    CloseTable2();
    CloseTable();
    include('footer.php');
    return true;
    break;

    default:

    return $output->GetOutput();
    break;

    }
    [/php:1:8c581c6569]

    This breaks pnHTML compliancy to a small degree I know, however, it's conditional upon the admin of the site in question and can make the output MUCH nicer on some installations.

    [EDIT] I forgot to add the header and footer files required to make this work when I posted it.

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula