Welcome Guest, Not a member yet? Register   Sign In
Passing anchor attribute or title as variable to a controllers display function
#2

[eluser]debow[/eluser]
I've been able to work out a solution. I'm not sure if its the best solution but it works.

I've changed my links to the below code in my home.php/navigation div.

Code:
<li class="cat-item cat-item-14">&lt;?php echo anchor('filesystems/display?id=1', 'Filesystems', 'title="View All OS filesystem commands"');?&gt;
<ul class='children'>
<li class="cat-item cat-item-16">&lt;?php echo anchor('filesystems/display?id=2', 'AIX', 'title="View only AIX filesystem commands"');?&gt;
</li>
<li class="cat-item cat-item-17">&lt;?php echo anchor('filesystems/display?id=3', 'HPUX', 'title="View only HPUX filesystem commands"');?&gt;
</li>
<li class="cat-item cat-item-18">&lt;?php echo anchor('filesystems/display?id=4', 'LINUX', 'title="View only LINUX filesystem commands"');?&gt;
</li>
</ul>
</li>


Then in my controller.

I'm using one function.

Code:
function display($sort_by = 'ostype', $sort_order = 'asc', $offset = 0, $id='') {
        
    $id3 = $_GET['id'];    /Added this
    $data['item3'] =$id3;  /Added this
        
        $limit = 10;
        $data['fields'] = array(
        //'command' => 'Command',
        //'description' => 'Description',
        //'comments' => 'Comments',
          'ostype' => 'OS',
        );//The above is really to allow certain colums to be sortable, can get them with out the array but unable to sort them

if($data['item3'] == "1"){
   $results = $this->Fs_model->search($limit, $offset, $sort_by, $sort_order);
   $data['htitle'] = "ALL OS FileSystem Commands";
        }
   elseif($data['item3'] == "2"){
     $results = $this->Fs_model->search_aix($limit, $offset, $sort_by, $sort_order);    
     $data['htitle'] = "AIX Only FileSystem Commands";    
        }
   elseif($data['item3'] == "3"){
      $results = $this->Fs_model->search_hpux($limit, $offset, $sort_by, $sort_order);
      $data['htitle'] = "HPUX Only FileSystem Commands";        
        }
   elseif($data['item3'] == "4"){
     $results = $this->Fs_model->search_linux($limit, $offset, $sort_by, $sort_order);    
     $data['htitle'] = "Linux Only FileSystem Commands";
        }

.......rest of code

Again not sure if this is the best way but it worked for what I was trying to get done.


Messages In This Thread
Passing anchor attribute or title as variable to a controllers display function - by El Forum - 04-15-2011, 01:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB