Forum Activity

Forum feed

Am I correctly formatting pntables file  Top

  • 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');
  • 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...."
  • 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.

This list is based on the users active over the last 60 minutes.