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

Dizkus

Bottom
Am I correctly formatting pntables file
  • Posted: 22.01.2005, 08:04
     
    irasmith
    rank:
    Helper Helper
    registered:
     April 2003
    Status:
    offline
    last visit:
    20.07.05
    Posts:
    370
    If I have a module called pnSomeModule with a table of SomeTable with columns of Column1, Column2, and Column3, would my pntables entry look something like what I have below?

    Code

    function pnSomeModule_pntables()
    {
        // Initialise table array
        $pntable = array();

        // Get the name for the Example item table.  This is not necessary
        // but helps in the following statements and keeps them readable
        $pnSM = pnConfigGetVar('prefix') . '_pnSM';

        // Set the table name
        $pntable['pnSomeModule'] = $pnSM;

        // Set the column names.  Note that the array has been formatted
        // on-screen to be very easy to read by a user.
        $pntable['pnSomeMoudle_SomeTable_column'] = array('first_name'      => 'Column1',
                                           'middle_name' => 'Column2',
                                           'last_name'   => 'Column3');
  • Posted: 22.01.2005, 12:46
     
    Landseer
    rank:
    Developer Developer
    registered:
     January 2003
    Status:
    offline
    last visit:
    27.11.08
    Posts:
    851
    That won't work, sorry, there are several bugs and typos ('Moudle') in the code.

    Have a look at the Example module how to define the tables. In pnForum it looks like this:

    Code

    // Initialise table array
        $pntable = array();

        $pnforum_categories = pnConfigGetVar('prefix') . '_pnforum_categories';
        $pntable['pnforum_categories'] = $pnforum_categories;
        $pntable['pnforum_categories_column'] = array('cat_id'    => $pnforum_categories . '.cat_id',
                                            'cat_title'   => $pnforum_categories . '.cat_title',
                                            'cat_order'   => $pnforum_categories . '.cat_order');


    You see, you have to add the tablename as part of the fieldnames too.

    --
    "He is not dangerous, he just wants to play...."
  • Posted: 22.01.2005, 20:46
     
    irasmith
    rank:
    Helper Helper
    registered:
     April 2003
    Status:
    offline
    last visit:
    20.07.05
    Posts:
    370
    Thanks for your input to my question. I wasn't quite getting the connection through looking at the Example module but I think I follow along now.

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula