EllisLab text mark
Advanced Search
     
Help with categoris and subcategory
Posted: 08 October 2012 04:10 PM   [ Ignore ]
Avatar
Joined: 2012-09-10
12 posts

plase i need help

I need to make dropdown like this

Castrol
  Castrol->Castrol model
Aral
  Aral->Aral model

dropdown
Aral>Aral model

 
Posted: 08 October 2012 09:57 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2012-04-02
85 posts

What code do you have? You are not providing any explanation and guess this doesn’t help us to help you:

Dzemail - 08 October 2012 04:10 PM

Castrol
  Castrol->Castrol model
Aral
  Aral->Aral model

dropdown
Aral>Aral model

 
Posted: 09 October 2012 01:39 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2012-06-11
11 posts
Dzemail - 08 October 2012 04:10 PM

plase i need help

I need to make dropdown like this

Castrol
  Castrol->Castrol model
Aral
  Aral->Aral model

dropdown
Aral>Aral model


Please provide some more details.
Castrol and Aral , are they referring to model names?

 Signature 

Simple is never Simple

 
Posted: 09 October 2012 08:12 AM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2012-09-10
12 posts

the view i wont is :

<td>Parent Category:</td>
<
td><select name="parent_id">
<
option value="0"> --- None --- </option>
<
option value="1">Desktops</option>
<
option value="5">Desktops PC</option>
<
option value="6">Desktops Mac</option>
<
option value="8">Laptops Notebooks</option>
<
option value="9">Laptops Notebooks Macs</option>
<
option value="10">Laptops Notebooks Windows</option>
</
select></td

My code from model is

public function drop()
         
{
           $qveri 
$this->db->select('ID,ime')
           ->
from('cate')
           ->
get()->result();
           
           
$podateke=array('' => '');
          
           foreach(
$qveri as $rows)
           
{
            $podateke[$rows
->ID] $rows->ime;
            
           
}
           
           
return $podateke;
         


Like this is my code the view dropdown what i need id up if u have some ideas please help

 
Posted: 09 October 2012 08:51 AM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-25
1009 posts

http://ellislab.com/codeigniter/user-guide/helpers/form_helper.html

Look at the section “dropdown” - you can pass a multidimensional array to the
dropdown helper. Looks like you want to achieve.

 
Posted: 09 October 2012 10:16 AM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2012-09-10
12 posts

Yes but i cant do it beceause i need help

 
Posted: 09 October 2012 01:15 PM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Avatar
Joined: 2012-04-02
85 posts

What other help do you need? or you meant “Yes but i cant do it because i need help (The completed code)” ??

 
Posted: 09 October 2012 03:43 PM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Avatar
Joined: 2012-09-10
12 posts

This what I need

<td>Parent Category:</td>
<
td><select name="parent_id">
<
option value="0"> --- None --- </option>
<
option value="1">Desktops</option>
<
option value="5">Desktops PC</option>
<
option value="6">Desktops Mac</option>
<
option value="8">Laptops Notebooks</option>
<
option value="9">Laptops Notebooks Macs</option>
<
option value="10">Laptops Notebooks Windows</option>
</
select></td

And my code is Model:

public function drop()
         
{
           $qveri 
$this->db->select('ID,ime')
           ->
from('cate')
           ->
get()->result();
           
           
$podateke=array('' => '');
          
           foreach(
$qveri as $rows)
           
{
            $podateke[$rows
->ID] $rows->ime;
            
           
}
           
           
return $podateke;
         

MY Controller

class Welcome extends CI_Controller 
{
    
  
public function index()
  
{
    $this
->load->model('data'); 
           
$data['neki']=$this->data->drop();
    
$this->load->view('welcome_message',$data);
  
}

My View :

<p>Category Option <?php echo form_dropdown('dr',$neki); ?></p

thakns

have nice day