I have a problem that concerns blog posts and displaying the tag words from another table. I seem to be able to pull the info out of the tables fine, however when I try to display the posts and the tags, I get one tag per post. In other words if I have 7 tags for a post, I get 7 iteration's of that post each with one tag instead of 1 post with 7 tags.
Benim Kontrolörü (hakkında bir soru var mı bu-> db-> get (mesajlar, etiketleri) olduğunu doğru
$this->db->order_by('posts.id', 'DESC');
$where = "publish";
$this->db->where('status', $where);
$this->db->join('tags', 'tags.post_id = posts.id');
$this->db->limit('7');
$query = $this->db->get('posts', 'tags');
if($query->result())
$data = array();
{
$data['blog'] = $query->result();
}
$data['title'] = 'LemonRose';
$data['content'] = 'home/home_content';
$this->load->view('template1', $data);
The view. $limit = 5; // how many posts should we show in full? $i = 1; // count
foreach ($blog as $row):
$permalink = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].$_SERVER['QUERY_STRING'];
$url = CompressURL ("$permalink");
$description = $row->title . $row->post;
$twittermsg = substr($description, 0, 110);
$twittermsg .= "...more " . $url;
if ($i < $limit) // we are under our limit
{ ?>
<div class="titlebox">
<div class="title"><? echo ucwords($row->title); ?></div>
<span><? echo $row->date, nbs(10), $row->author; ?></span>
</div>
<div class="clear"></div>
<? $str = str_word_count($row->post, 0);
if ($str >= 500) {
$row->post = html_entity_decode($row->post);
$row->post = $this->typography->auto_typography($row->post); // display?>
<div class="split"> <? echo $row->post = word_limiter($row->post, 480); ?>
<div class="tags"><? echo $row->tag; ?></div>*** These 3 lines seem to be where I am confused and getting the wrong display
<p><h3>More <?php echo anchor("main/blog_view/$row->id", ucwords($row->title)); ?> </h3></p>
<p>Trackback URL: <? echo base_url() . "trackbacks/track/$row->id"; ?></p>
<!-- tweet me -->
<?echo anchor("http://twitter.com/home?status=$twittermsg", 'Tweet'); ?>
Bu katılmak benim ilk denemem olduğunu ve gitmek için doğru yolu ise ben, implode ile görüntüyü almak için çok az deneyime sahip.
Şimdiden teşekkür ederim.