09-20-2009, 07:12 AM
[eluser]daparky[/eluser]
I'm just wondering if it's bad practice to use model functions in a view file, for example, i have the following in a view file:-
The reason i put $getdomains = $this->Extra->getDomains($clients->id); in the view is because i couldn't get it working in the controller.
Just wondered what your thoughts of putting model calls in view?
I'm just wondering if it's bad practice to use model functions in a view file, for example, i have the following in a view file:-
Code:
<?php
if($count > 0) {
foreach($clients as $clients) { ?>
<tr>
<td><?= $clients->name; ?></td>
<td><?= $clients->email; ?></td>
<td>
<?php
$getdomains = $this->Extra->getDomains($clients->id);
$i=0;
$num = count($getdomains);
if($getdomains > 0)
{
foreach($getdomains as $getdomains){ $i++; ?>
<?= $getdomains->dname; ?> <?php if($i == $num) { echo ''; } else { echo ','; } ?>
<?php }
} ?>
</td>
</tr>
<?php }
} ?>
The reason i put $getdomains = $this->Extra->getDomains($clients->id); in the view is because i couldn't get it working in the controller.
Just wondered what your thoughts of putting model calls in view?