CakePHP - Iterate through variable passed from Controller to View by using plain query -
CakePHP - Iterate through variable passed from Controller to View by using plain query -
i passing next variable tagscount
controller view:
$this->set('tagscounts', $this->tag->query(' ( select t.id, t.sk_name, 0 count tags t t.id not in ( select tag_id video_tags vt ) ) union ( select t.id, t.sk_name, count( * ) count videos v bring together video_tags vt on ( v.id = vt.video_id ) bring together tags t on ( t.id = vt.tag_id ) grouping t.id order count( * ) asc )' ));
and in view want iterate trough variable. using code:
<?php for($z = 0; $z < sizeof($tagscounts); $z++): ?> <?php echo $tags[$z]['tag']['count'];?> <br> <?php endfor; ?>
but causes error:
strict standards: non-static method string::insert() should not called statically, assuming $this incompatible context in /storage/hotweb/admin.porner.sk/cake/libs/debugger.php on line 673
and also
notice (8): undefined index: count [app/views/tags/index.ctp, line 20]
could please help me how iterate through variable , print column called "count"?
cakephp cakephp-1.3
Comments
Post a Comment