CodeIgniter Forums

Full Version: Noob: Advice on Next / Prev functions and anchors ...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]bloopy[/eluser]
Hi,

I have two problems caused by two anchors that find the next / previous row of a DB.
As they are call separate functions my URL goes from "localhost/details/3" to "localhost/PREVIOUS/2"

Q1: What's the CORRECT way to integrate both functions so the URL remains the same ?

Q2: How do you make the anchors disappear if they are on the first or last row of the DB ?

Some code ...

This is my original function:
Code:
function details()
    {
        $data = array();
        
        if($query = $this->site_model->select_records())
        {
            $data['site'] = $query;
        }
      
        $this->load->view('blah');

And this is my 'Previous' function:
Code:
function previous()
    {
        $data = array();
        
        if($query = $this->site_model->previous_record())
        {
            $data['site'] = $query;
        }
        $this->load->view('blah');
    }

Sorry for the noob question, I've only been working on CI for two weeks ! :-)

El Forum

[eluser]InsiteFX[/eluser]
Pagination Class

Enjoy
InsiteFX

El Forum

[eluser]bloopy[/eluser]
[quote author="InsiteFX" date="1268686354"]Pagination Class

Enjoy
InsiteFX[/quote]

Thanks for the quick reply!
I originally thought the pagination class would work, but ...

1/ I only have one record selected at this point.
2/ I couldn't customise the links to only show ONLY '<' and '>' symbols.

I have a feeling pagination is the answer, unfortunately I'm still getting to grips with CI.

El Forum

[eluser]bloopy[/eluser]
Ok, so after a bit of playing it looks like pagination IS the answer I'm looking for.
I still can't customise it how I'd like though ... anyone ?

El Forum

[eluser]Amzad Hossain[/eluser]
If you are in so much in need of that look then hack the core .. Smile

El Forum

[eluser]bloopy[/eluser]
Eeep, I think I'll leave it then. :lol:

El Forum

[eluser]danmontgomery[/eluser]
I don't use the pagination class, but I would think you could do something like:

Code:
$config['num_tag_open'] = '&lt;!--';
$config['num_tag_close'] = '--&gt;';
$config['first_tag_open'] = '&lt;!--';
$config['first_tag_close'] = '--&gt;';
$config['last_tag_open'] = '&lt;!--';
$config['last_tag_close'] = '--&gt;';

To hide all of the links except next/prev page in html comments so they aren't visible

El Forum

[eluser]bloopy[/eluser]
Legend ! that's exactly what I'm looking for. :-)
Well, I've pretty much got what I'm after now, thanks for all your help guys.