<?php
<div class="someclass">
<ul class="someclass">
foreach ($this->showonline as $key => $friend) {
<li>
$friend['avatar'];
$friend['name'];
</li>
}
</ul>
</div>
?>
exmple :-
- model.php
- class.php
- hook.php
- index.phtml
with model i get database information. with class im calculating online friend list as a array using array_intersect. and with hook i render to index.phtml. in phtml i use foreach loop and get the result to my online friendlist.
Here is my function im getting online user list with this. but if new user come to online i must refresh the page to see new online member. i want to make it auto update list. with ajax or something. can someone give me example how can i do that?
You may use setTimeout function, either to reload the page or to call ajax and update the page content. here is small idea.