1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Data missing in list page of custom module

Discussion in 'Plesk 9.x for Linux Issues, Fixes, How-To' started by MiriamK, Nov 30, 2010.

  1. MiriamK

    MiriamK Guest

    0
     
    Hi,

    I am new to plesk module development. I have a new requirement to develop a module for listing and selecting some items. I have used the following code to list the items.
    --------------------------------------------------------------------------------
    file: mylist.php
    <?php
    class mylist extends pm_cList {
    function fetchmylist() {

    $this->columns_ = array();
    $this->list_ = array();

    $this->columns_ = array(
    '0' => array('name' => 'ItemName', 'sort' => 'ItemName'),
    );

    $productslist = db_query('SELECT ItemName FROM module_my_items');
    while($row = db_fetch_assoc($productslist)) {
    $this->list_[] = $row;
    }
    function ItemNameGet() {

    }
    }
    ?>
    My list_ array is:
    Array
    (
    [0] => Array
    (
    [ItemName] => item 1
    )

    [1] => Array
    (
    [ItemName] => item 2
    )
    ............
    )


    --------------------------------------------------------------------------------
    In index.php, I use the following code to fetch the list which is assigned to the template variable for display.

    $list = new mylist;
    $list->setFSP('setPage');
    $list->init();
    $listdisplay = $list->get();
    --------------------------------------------------------------------------------

    When I run this code I am getting the "list template" correctly. I mean only the template structure is shown, with no data listed. When I debugged the code, I could see that the count of table rows and the column headings are correct. Please let me know which function do I need to call, otherthan $list->get(), to get the listing correctly. I could not trace which function will display the item names.

    Thank you,
    Miriam
     
Loading...