Welcome Guest, Not a member yet? Register   Sign In
Mega Doubt - Categories and SubCategories Dynamic Navegation Menu
#1

[eluser]MEM[/eluser]
I hope to get your help on this:

Preliminary:
a) I'm using template views, or views loading other views as my system. I'm sorry, I just feel more comfortable like this.
b) I'm having one table categories with one "parent_id_cat" column. I don't have two tables.

Request:
The point here is to have, on a page, three category menus:
One: for the main categories. (it will be on top).
A Second: for the sub categories. (it will be on the left side).
The third: for the sub-subcategories (it will be side-by-side with menu 2).
I can put the first and second menus nicely. But when I put the third, it overs my second one, because I’m using the same method for both.

What I have:
On my MODELI have the following:
Code:
function getSubCategorias($id_cat)
{
    $this->db->where('parent_id_cat', $id_cat);
            
    $this->db->where('activa_cat =', 1);
            
    $query=$this->db->get('categoria');
            
    if($query->num_rows()>0)
    {
        return $query->result();
    }
}}

On my CONTROLLER I have this:
Code:
function seccao($id)
{
        
$cat = $this->M_Categoria->getCategoria($id);
                
$data['menuprincipal'] = $this->M_Categoria->getCategoriasPrincipais();
        
    $data['menucategorias'] = $this->M_Categoria->getSubCategorias($cat->id_cat);
        
    $data['categoria'] = $cat;
        
    $data['main'] = 'v_categoria';
    
$this->load->vars($data);    
$this->load->view('geral_tpl');



On my VIEWS have this:


Header view

Code:
<?php
    echo "<ul>";
        foreach ($menuprincipal as $categoria)
        {
            echo "<li>";
echo anchor("c_categoria/seccao/{$categoria->id_cat}",$categoria->nome_cat);
                                        
            echo "</li>";
                                    }
    echo "</ul>";

?&gt;

Category view:
Code:
<div id="menu_vertical">
    &lt;?php
     echo "<ul>";
         foreach ($menucategorias as $subcategoria)
         {
            echo "<li>";
echo anchor("c_categoria/seccao/{$subcategoria- >id_cat}",$subcategoria->nome_cat);
            echo "</li>";
          }
        echo "</ul>";    
    ?&gt;
</div>




Can I have your help on modifying this, in order to have the third menu also displayed like the other two?




Thanks a lot,
Márcio


Messages In This Thread
Mega Doubt - Categories and SubCategories Dynamic Navegation Menu - by El Forum - 09-01-2009, 07:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB