Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Breadcrumbs should be in the controller. I use CodeIgniter and do something like</p> <pre><code>$data['breadcrumb'][0] = array("title" =&gt; "Home", "alt" =&gt; "Home Page", "path" =&gt; "home/"); $data['breadcrumb'][1] = array("title" =&gt; "About", "alt" =&gt; "About Me", "path" =&gt; "home/about"); </code></pre> <p>And then in the view loop through and display them as a list.</p> <pre><code>&lt;ul class="breadcrumbs"&gt; foreach($breadcrumb as $b) { ?&gt; &lt;li&gt;&lt;a href="&lt;?php echo base_url(); ?&gt;index.php/&lt;?php echo $b['path'];?&gt;" alt="&lt;?php echo $b['alt']; ?&gt;"&gt;&lt;?php echo $b['title']; ?&gt;&lt;/a&gt;&lt;/li&gt; &lt;?php } &lt;/ul&gt; </code></pre> <p>You can then also declare simple things like classes, current pages, etc. The only downside is you have to set the breadcrumbs in every page. </p> <p><strong>ALL</strong> logic should be in the controller. Access databases through the models, perform logic in the controller, and pass it to the view.</p> <p>Simple stuff like</p> <pre><code>&lt;?php echo ($loggedin)?"Logged in as" . $user-&gt;firstname:"Not logged in";?&gt; </code></pre> <p>can be in the view. But you shouldn't be setting up complex flow patterns. Leave that to the controller. Views are cheap. You can have a half dozen slightly different views and no one will care. It's not like static HTML where you would have to maintain a half dozen pages.</p> <p>Include common things in the views (like headers, footers, script files, javascript files, etc) and then let them be.</p>
 

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