I have a tab panel and 2 separate tabs in which I can upload and display pictures. Currently both of them show the same pictures eg if I upload picture in one tab then it is automatically shown in another tab also. I want to make each tab recognise and load only those pictures that are loaded to that tab only. Both tabs are sharing the same database table and I am using PHP to access the data. It’s Zend MVC pattern and I am wondering how to make tab content unique on the basis of a field in the table. I am sending url with tabid to controller and it saves it in the database but I am having problem in retrieving the content from the database and showing them in the each of the tabs. I would be grateful if anyone can provide some guidance.
url sent from javascript : attachments/gallery?tabid=1?
Inside php controller:
public function galleryAction(){
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer('gallery');
$attHelper = $this->_helper->getHelper("attachmentsHelper");
$type= $this->_getParam('type', "");
$tabId= $this->_getParam('tabid', "");
try {
$model = $attHelper->load($type, $tabId);
$array = array();
if (is_array($model)){
foreach($model as $att){
$item = array(
'id' => $att->getId(),
'user_id' => $att->getUserId(),
'description' => $att->getDescription(),
//'tabid' =>$att->getTabId() -this doesn't work and gives an error eventhough value is stored in database
);
$array[] = $item;
}
}
print("tabId".$tabId); // doesn't show value of tab id and doesn't display all the images uploaded in that tab
}
//$json["attachments"] = $array;
$this->view->attachments = $array;
}catch (Exception $e){
}
}
query inside load function:
$select->where('type = ?', $type)
->where('tabid = ?', $tabId); // do i hav to modify it?
$rows = $dbtable->fetchAll($select);