```
<?php        
<div class="someclass">
    <ul class="someclass">
        foreach ($this->showonline as $key => $friend) {
        <li>
            $friend['avatar'];
            $friend['name'];
        </li>
        }

    </ul>
</div>
?>

```

exmple :-

1. model.php
2. class.php
3. hook.php
4. 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?