Welcome Guest, Not a member yet? Register   Sign In
Using model functions in View
#1

[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:-

Code:
<?php
            if($count > 0) {
            foreach($clients as $clients) { ?>
            <tr>
                
                <td>&lt;?= $clients->name; ?&gt;</td>
                <td>&lt;?= $clients->email; ?&gt;</td>
                <td>
                &lt;?php
                $getdomains = $this->Extra->getDomains($clients->id);
                $i=0;
                $num = count($getdomains);
                if($getdomains > 0)
                {
                    foreach($getdomains as $getdomains){ $i++; ?&gt;
                    
                    &lt;?= $getdomains->dname; ?&gt; &lt;?php if($i == $num) { echo ''; } else { echo ','; } ?&gt;

                &lt;?php }
                } ?&gt;
                </td>
            </tr>
            &lt;?php }
            } ?&gt;

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?


Messages In This Thread
Using model functions in View - by El Forum - 09-20-2009, 07:12 AM
Using model functions in View - by El Forum - 09-20-2009, 07:19 AM
Using model functions in View - by El Forum - 09-20-2009, 08:14 AM
Using model functions in View - by El Forum - 09-20-2009, 08:29 AM
Using model functions in View - by El Forum - 09-20-2009, 09:22 AM
Using model functions in View - by El Forum - 09-20-2009, 11:59 AM
Using model functions in View - by El Forum - 09-20-2009, 02:36 PM
Using model functions in View - by El Forum - 09-20-2009, 03:42 PM
Using model functions in View - by El Forum - 09-20-2009, 05:58 PM
Using model functions in View - by El Forum - 09-20-2009, 06:41 PM
Using model functions in View - by El Forum - 09-20-2009, 07:52 PM
Using model functions in View - by El Forum - 09-21-2009, 01:31 AM
Using model functions in View - by El Forum - 09-21-2009, 06:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB