I have a specific tpl being defined within the theme and the specific view function contains a function that calls the webservice.
It saves it within the items array which then outputs as variables to the tpl file. However, there is another tpl which is an alternative view for original file but currently has no values.
To fix this, in the original webservice, i store it within sessions and grab data that way. What would be the drupal solution??
function EXAMPLE_theme(){
return array(
'list_view' => array(
'template' => 'list-view',
'variables' => array('items' => NULL)
),
'table_view' => array(
'template' => 'table-view',
'variables' => array('items' => NULL)
)
);
}
function list_view($form_state){
$items = array();
$data = form_data($form_state);
// FOR LIST VIEW TEMPLATES
$items['data'] = webservice($data);
//FOR OTHER TEMPLATES (TABLE-VIEW)
if(isset($_SESSION['data_view'])){
unset($_SESSION['data_view']);
}
$_SESSION['data_view'] = $items['data'];
return theme('list_view', $items);
}