php - How to print out the value in view file? -
php - How to print out the value in view file? -
i have array that, want print out in view file, it's empty, array
array( (int) 0 => array( 'productsusernode' => array( 'product_user_node_id' => '155', 'user_node_id' => '53', 'product_id' => '1', 'is_active' => '1', 'expiry' => '0000-00-00', 'created' => '2013-01-10 10:27:22', 'modified' => '2013-01-10 10:27:22', 'created_view' => '10:27 am, jan 10,2013', 'modified_view' => '10:27 am, jan 10,2013' ), 'usernode' => array( 'user_node_id' => '53', 'division_id' => '28', 'role_id' => '4', 'user_id' => '56', 'created' => '2013-01-10 10:27:20', 'created_view' => '10:27 am, jan 10,2013' ), 'product' => array( 'product_id' => '1', 'name' => 'manager', ) ),
i using code in view file
foreach ($products $products) { ?> <tr> <td> <?php $products['productsusernode']['product_id']?> </td> <td> <?php $products['product']['name']?> </td> </tr> <?php }?>
i have set variable in controllerlike that,
$this->set('products',$products);
but not working, what's problem? in advance
use echo
keyword print variables.
foreach ($products $product) { ?> <tr> <td> <?php echo $product['productsusernode']['product_id']?> </td> <td> <?php echo $product['product']['name']?> </td> </tr> <?php }?>
php cakephp cakephp-1.3 cakephp-2.0
Comments
Post a Comment