• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Data missing in list page of custom module

M

MiriamK

Guest
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
 
Back
Top