Use an element.
1) In your UsersController you have a function that returns the count
of live users:
class UsersController extends AppModel {
....
function getCountLiveUsers() {
//perform the calculation
return $n;
}
}
2) Create /view/elements/number_of_live_users.ctp whith this
/*File number_of_live_users.ctp */
$n = $this->requestAction('/users/getCountLiveUsers');
echo $n;
/*EOF*/
3) and finally, in your layout default.ctp or whatever view, you can
use your element.
<html>
<head> ... </head>
<body>
There are <?php echo $this-
>element('number_of_live_users') ?>
</body>
</html>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---