I am trying to pass db info to a template, I have read the tut on reading and writing from the database - simpletext. I don't understand how the variable "$simpleText" was used in the for each loop. Is this variable defined in the controller or model?
Generally speaking, the controller passes the variables to the templates in the response parameters. That variable can then be used in the template. You will have to show the full code for anyone to give you a more specific answer.
I seem to be stuck again within my for each loop, I don't have the error anymore for my arry but it will not display anything within the page.
//code within my Model class
public function getAllProcessors()
$rows = $this->fetchAllKeyed("SELECT * FROM `xf_api` ORDER BY `api_title` ASC", 'api_id');
$i = 0;
$values = array();
foreach($rows as $value)
$values[$i]['api_id'] = $value['api_id'];
$values[$i]['api_title'] = $value['api_title'];
$values[$i]['api_active'] = $value['api_active'];
$values[$i]['api_currency'] = $value['api_currency'];
$values[$i]['api_recurring'] = $value['api_recurring'];
public function actionIndex()
$viewParams = array( 'api' => $this->_getModel()->getAllProcessors() );
return $this->responseView('API_ViewAdmin_API', 'api', $viewParams);