Welcome Guest, Not a member yet? Register   Sign In
Noob: Advice on Next / Prev functions and anchors ...
#1

[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 ! :-)
#2

[eluser]InsiteFX[/eluser]
Pagination Class

Enjoy
InsiteFX
#3

[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.
#4

[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 ?
#5

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

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

[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
#8

[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.




Theme © iAndrew 2016 - Forum software by © MyBB