Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9211683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:21:11+00:00 2026-06-18T01:21:11+00:00

I ask this https://stackoverflow.com/a/14277726/1670630 on other post but my problem still exist. In codeigniter

  • 0

I ask this https://stackoverflow.com/a/14277726/1670630 on other post but my problem still exist.
In codeigniter 2.1 I’m trying to display channels by category. So if i have a category called Film, i should see a list of Channels within Film. I tried a nested foreach loop to accomplish this but can’t seem to get it to work in the slidshow and limit by number of row.
My model:

<?php

class Pages_model extends CI_Model {


function get_channels_by_categ_tv()
{

  $this->db->select('categories.category_name, channels.channel_name');
  $this->db->from('type_categ');
  $this->db->join('categories', 'categories.category_id = type_categ.category_id');
  $this->db->join('channels', 'channels.channel_id = type_categ.channel_id');
  $this->db->order_by('categories.category_id');
//$this->db->group_by(array('categories.category_id')); 
  $query = $this->db->get();

  if($query->num_rows() == 0)
  {
    #no channels
    return false;
  }

  return $query->result_array();
}

}

I have this in the view:

<ul class="slides">
   <li>
      <?php $cat_shown = ''; ?>
         <div class="programe-tv_link">
                <?php $cat_show = ''; $cnl_show = '';?>
                <?php foreach ($category_chaneels as $category): ?>
                    <?php
                    if ($cat_show != $category['category_name']) {
                        $cat_show = $category['category_name'];
                        echo '<p>' . $cat_show . '</p>'; 
                    }
                    $cnl_show = $category['channel_name'];
                    echo '<dd><a href=""> >>' . $cnl_show . '</a></dd> '; 
                    ?>    
                <?php endforeach; ?>  
          </div>
     </li>
     <li>
              <div class="programe-tv_link">
                    <p>Arte</p>
                   <dd> <a href="">>> Acasa</a></dd>
                   <dd> <a href="">>> Antena 1</a></dd>
                   <dd> <a href="">>> Pro TV</a></dd>
                </div>
                <div class="programe-tv_link">
                    <p>Music Box</p>
                   <dd> <a href="">>> Acasa</a></dd>
                   <dd> <a href="">>> Antena 1</a></dd>
                   <dd> <a href="">>> Pro TV</a></dd>
                   <dd> <a href="">>> TLC</a></dd>
                </div>
      </li>
  </ul>

I atache image with ilustration, enter image description here

sorry for my english and if you don’t understund me please write here. THX in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:21:13+00:00Added an answer on June 18, 2026 at 1:21 am

    My finale code is this.

        <div id="programe-tv-slide" class="flexslider">
            <strong>Programe TV</strong>
            <div class="redLine"></div>
    
            <?php $cat_cnl = array(); 
                  $list = array(); 
                  $i=1;
                     foreach ($category_chaneels as $option) { 
                        $catname = $option['category_name'];
                        $chlname = $option['channel_name'];
    
                        $cat_cnl[$catname][$i] = $chlname;
                        $list[$i] = $catname;
                  $i++;
                     }; 
            ?>
            <?php 
                $rows = array_chunk($cat_cnl, 4, TRUE);
                foreach ($rows as $row) {  //var_dump($rows);
            ?>
    
              <ul class="slides">    
                <?php
                    echo ('<li>');
                    foreach ($row as $category => $channels) {
                        echo '<div class="programe-tv_link">'; 
                        echo '<p>' . $category . '</p>'; 
                            foreach ($channels as $channel) {
                                    echo '<dd><a href="">' . $channel . '</a></dd> '; 
                            };
                        echo '</div>'; 
                        };      
                    echo ('</li>'); 
                ?>
              </ul>
              <?php }; ?>
        </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example form, https://stackoverflow.com/questions/ask and I save this page to desktop. Then I edit the
I need to get the query string from this URL https://stackoverflow.com/questions/ask?next=1&value=3 and I don't
I've already asked this here -> https://stackoverflow.com/questions/11289701/how-to-make-connection-between-paypal-accounts , but I read about PayPal and
Building on this answer: https://stackoverflow.com/a/2349824/1382306 Are there further guidelines in A and B's usages,
From any URL I want to extract its path. For example: URL: https://stackoverflow.com/questions/ask Path:
I want to reach something like this: if(window.location.href.indexOf(http://stackoverflow.com/questions/)){ ... then to this } but
This is an example URL. http://stackoverflow.com/questions/ask?a=1&b=2 question : I need to fetch path name
Been looking for hours. At https://stackoverflow.com/questions/ask how does the Tags section make the blue
For instance, this url is http://stackoverflow.com/questions/ask , instead of something like http://stackoverflow.com/questions/ask.aspx . How
Imagine this is my URL NSURL *theURL=[NSURL URLWithString:@http://stackoverflow.com/questions/ask]; How can i extract only: http://stackoverflow.com

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.