1
4

2 回答 2

2

Use server side session for this , anchor tag link to index_fanme_Asc url .

public function index_fname_Asc()
{
   // i didn't test .. you can change into ci session 
   if ( isset($_SESSION['hasClicked']) && $_SESSION['hasClicked'] ){

        $this->index_fname_Dsc();
        return ;
   }

   $_SESSION['hasClicked'] = true;

   $this->load->view("admin/myview1");
}

public function index_fname_Dsc()
{
     $_SESSION['hasClicked'] = false;

     $this->load->view("admin/myview2");
}

hope this will works

于 2013-04-24T12:38:17.437 回答
0

You could easily switch between these href's by using data from the controller. For example:

public function index_fname_Asc()
{
  $data['sort'] = 'ASC';  
  $this->load->view("admin/myview1",$data);

}

public function index_fname_Dsc()
{
  $data['sort'] = 'DESC';  
  $this->load->view("admin/myview2");
}

Then in the view:

if($sort == "ASC"){
 echo "<td <a href=" . site_url("// My method's Url") .">First Name</a></td>"
}else{


 //Other href
 }

Hope this helps!

于 2013-04-24T12:33:20.937 回答