I am using the Zend Framework ,I want to convert XML to array and show them in view
Here is my code:
Controller:
public function reportAction(){
$reportModel = new Model_Report();
$select_report = $reportModel->fetchAll($reportModel->select()->where( "phone = '888' )->order('date DESC'));
$rowCount = count($select_report);
$test = $select_report->toArray();
print_r($test[0]['message']) ;
if ($rowCount > 0) {
$this->view->rowCount = count($select_report);
$this->view->rowArray = $select_report->toArray();
}
}
View :
<table>
<tr>
<th>voice</th>
<th>quality</th>
<th>network connection</th>
</tr>
<?php
for ($i=0 ; $i<$this->rowCount; ++$i)
{
print '<td>'. ($this->rowArray[$i]['message']).'</td>';
}?>
</table>
My XML in message like this :
<root><voice>false</voice><quality>false</quality><network>true</network></root>
I want to show XML's value in table in View. but it just show : falsefalsetrue
No comments:
Post a Comment