Welcome Guest, Not a member yet? Register   Sign In
Simple MVC question
#1

[eluser]Unknown[/eluser]
Good people of CodeIgnitor, I am sure there is a simple answer to this but at the moment I can't see it.

I am dynamically looping through a database table in a view like so:

Code:
<?php foreach($records as $rows): ?>

<article class="summary">

<h2>&lt;?php echo $rows->title;?&gt;</h2>

<time class="summary-date" datetime="&lt;?php
// Find a CodeIgnitor-friendly way of displaying date as below
echo strftime("%Y-%m-%d", strtotime($rows->date));
?&gt;">&lt;?php
// Find a CodeIgnitor friendly way of display date as below
echo strftime("%B %d, %Y", strtotime($rows->date));  ?&gt;</time>

<div class="summary-category">Category: <a href="">&lt;?php echo $rows->category_id; ?&gt;</a></div>

<div class="summary-teaser">&lt;?php

// Uses text helper for nice clean break in string near to 320 characters
// Also uses typograhpy class to add HTML to the database text
// This produces nicely formatted blocks to text

echo $this->typography->auto_typography(character_limiter($rows->body, 320));

?&gt;</div>

<div class="read-more">Read more</div>

</article>

&lt;?php endforeach; ?&gt;

Now I need to take the value of the category variable (at the moment it is just a number) and take it back to the constructor and from there make a model database call so as to find the name of the category (relational databases and all that).

Now the question is how do I do that?




Theme © iAndrew 2016 - Forum software by © MyBB