Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've built my own framework in the past too so I know what you're going through. I've heard the saying "build fat models" and I agree with that -- as long as the main goal is to return data. I considered the controller to be "The Overlord" as it manipulated data and directed where it should go.</p> <p>For a login controller i might create something it like...</p> <p>Post URI: <a href="http://example.com/login/authenticate" rel="nofollow">http://example.com/login/authenticate</a></p> <pre><code>LoginController extends ParentController { public function authenticate() { $credential_model = $this-&gt;getModel('credentials'); // Obviously you should sanitize the $_POST values. $is_valid = $credential_model-&gt;isValid($_POST['user'], $_POST['email']); $view = $is_valid ? 'login_fail.php' : 'login_success.php'; $data = array(); $data['a'] = $a; // .. more vars $this-&gt;view-&gt;render($view, $data); } } </code></pre> <p>In my opinion data should always flow from the model -> controller -> view as it makes the most sense (data, manipulation, output). The View should only have access to what it has been given by the controller.</p> <p>As for this...</p> <blockquote> <p>Then if I'm dynamically calling my controller, how can I persist the data unique to the controller necessary to render the view?</p> </blockquote> <p>Well I would imagine you're building a 'base' or 'parent' controller that gets extended off of by your dynamically called controllers. Those child controllers can have properties that are needed for for the view to render -- honestly I'd need an example to go further. </p> <p>Hopefully this helps a bit. If you ask more specific questions I might be able to give a better thought out opinion.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload