Welcome Guest, Not a member yet? Register   Sign In
Pagination - Not working... again!
#1

[eluser]Devon Lambert[/eluser]
Ok,

I have no idea how I did it, but I've managed to break the pagination class, yet again.

I've been at this for about 1.5 hours now and I think it's time for bed. Before I retire, I wanted to submit this to the community and see if anyone may be able to assist?

I am able to get the first search page to show in the pagination but after that, my keyword/post data is lost, even though it should be getting pulled from the uri.

Here is the Search Controller:

Code:
<?php

class search extends Controller {



    function search()

    {

        parent::Controller();

        $this->load->model('mdl_search');



    }

    

    function index()

    {

        $data['title'] = "MY SEARCH FUNCTION";

        if ($this->input->post('keyword') != '') {

            $keyword = $this->input->xss_clean($this->input->post('keyword'));

        }

        else {$keyword = $this->uri->segment(2);}

        

        

        $data['count_results'] = $this->mdl_search->countResults($keyword);

            

        $this->load->library('pagination');



        $config['base_url'] = site_url('search/' . url_title($keyword));

        $config['total_rows'] = $data['count_results'];

        $config['uri_segment'] = '3';

        $config['per_page'] = '10';



        $this->pagination->initialize($config);



        $offset = $this->uri->segment(3);

        

        $data['search_results'] = $this->mdl_search->getSearchResults($keyword, $config['per_page'], $offset);

                        

        $this->load->view('arcade/header');

        $this->load->view('arcade/search', $data);

        $this->load->view('arcade/footer');

    }



}

?>

Here is the view:

Code:
<div class="search">

        &lt;?php if(isset($search_results) && !empty($search_results)) { ?&gt;

            <h2>&lt;?= $title;?&gt;</h2>

            <div class="pagination">&lt;?php echo $this->pagination->create_links(); ?&gt;</div>

            <table class="search-results">

                    <tr class="headerRow">

                        <th class="gameTitle"><a href="#"><span>Game Title</span></a></th>

                        <th class="active"><a href="#"><span>Players</span></a></th>

                        <th><a href="#"><span>Rating</span></a></th>

                        <th><a href="#"><span>Reviews</span></a></th>

                        <th><a href="#"><span>Play Type</span></a></th>

                    </tr>

                    

                        &lt;? foreach ($search_results as $search_result): ?&gt;

                            <tr class="alt">

                                <td class="title"><a href="#"><img src="&lt;?php echo base_url() ?&gt;images/img/&lt;?php echo $search_result['nameid'];?&gt;.png" alt="&lt;?php echo $search_result['name'];?&gt;" width="60" height="50"></a><div class="fltLft"><a href="#">&lt;?php echo $search_result['name'];?&gt;</a><br />&lt;?php echo $search_result['desc'];?&gt;</div></td>

                                <td class="players">1,262</td>

                                <td class="ratings"><b>5.00</b><br />out of 5.0</td>

                                <td class="reviews"><span class="up">72%</span><br />491 reviews</td>

                                <td><a href="#" class="btnSearchPlayNow clearLink">play now</a><a href="/servlet/DownloadEcommTracker?sku=texttwist&promoCode=SearchList" class="#">download</a></td>

                            </tr>

                        &lt;? endforeach; ?&gt;

            </table>

        &lt;?php } else { ?&gt;

            <h3>You didn't enter a search result, please re-renter.</h3>

        &lt;?php } ?&gt;

    </div>

Thanks to any who may help. :-)


Messages In This Thread
Pagination - Not working... again! - by El Forum - 07-16-2008, 01:02 AM
Pagination - Not working... again! - by El Forum - 07-16-2008, 03:29 AM
Pagination - Not working... again! - by El Forum - 07-16-2008, 09:08 AM
Pagination - Not working... again! - by El Forum - 07-16-2008, 09:35 AM
Pagination - Not working... again! - by El Forum - 07-16-2008, 11:12 AM
Pagination - Not working... again! - by El Forum - 07-16-2008, 11:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB