Previsous Next Project Links

lomp / 2012-06-02 11:24:13   

HI, this previous next project plugin doesn't seem to work with V2 : snipplr.com/view/61913/indexhibit-nextlink/

or I couldn't activate the plugin, because of the new plugin system. I don't know...

alemen A / 2012-06-02 11:34:41   

Hi lomp, plugins may need to be adapted to the new version, they might not work as they were written for the previous version.

Vaska A / 2012-06-02 12:01:48   

This may or may not be working - we'll work on this later (unless somebody fixes them up for us). For previous and next links:

  1. <plugin:pagination:get_prev_next_entries />

And, I think Visual Index has some built-in pagination code too - you might look at that too.

lomp / 2012-06-20 08:06:44   

Thanks aleman and vaska for your answers. I tried the plugin code, but it didn't work. So I just wait until someone writes a new one.

borispink / 2012-08-02 13:27:23   

I'd really like to implement the pagination plugin. I've been looking over plugin.pagination.php and can't unpick why it's not working at the moment.

lomp, I wondered if you had pursued this any further?

Also, I'm using indexpand -- not sure whether the subsection class could be further complicating things? If it's just going through page ID in ascending order I'd guess not...

borispink / 2012-10-06 23:07:58   

Just in case it's helpful for anyone, I revisited the plugin.pagination.php file and have got things running on my site.

The below code features a couple of edits, so it manually takes effect on a single section (id 4) which is organised chronologically, so it orders by year, then by object order.

  1. <?php if defined'SITE' exit'No direct script access allowed'
  1. class Pagination
  2. {
  3.     function get_prev_next_entries()
  4.     {
  5.         $OBJ =& get_instance();
  6.     
  7.         if ($OBJ->vars->exhibit['section_top'] == 1) return;
  8.         if ($OBJ->vars->exhibit['section_id'] == 1) return;
  9.     
  10.         // get all entries
  11.         $entries = $OBJ->db->fetchArray("SELECT title, url, id FROM ".PX."objects 
  12.             WHERE object = '" . $OBJ->vars->exhibit['object'] . "' 
  13.             AND section_top != '1' 
  14.             AND status = '1' 
  15.             AND section_id = '4' 
  16.             ORDER BY year DESC, ord ASC");
  17.             
  18.         
  19.         // loop through the array to find current and set the others
  20.         if ($entries)
  21.         {
  22.             foreach ($entries as $key => $entry)
  23.             {
  24.                 // bingo!
  25.                 if ($entry['id'] == $OBJ->vars->exhibit['id'])
  26.                 {
  27.                     // previous
  28.                     $previous = (isset($entries[$key - 1])) ? $entries[$key - 1] : '';
  29.                     $next = (isset($entries[$key + 1])) ? $entries[$key + 1] : '';
  30.                 }
  31.             }
  32.         
  33.             $s = "<div id='prev_new_entries'>";
  34.             if (!empty($next)) $s .= "<span id='newer' style=''><a href='" . BASEURL . "$next[url]' title='Older Exhibition'>←</a></span>";
  35.             if (!empty($next) && !empty($previous)) $s .= " ";
  36.             if (!empty($previous)) $s .= "<span id='older' style=''><a href='" . BASEURL . "$previous[url]' title='Newer Exhibition'>→</a></span>";
  37.             $s .= "</div>";
  38.         }
  39.     
  40.         return $s;
  41.     }
  42. }

There might be some excess in there (e.g. line 10, section id 1 return), but this was just a quick edit to suit my needs.

I also added in line 37 to only show a gap (or a bar, or slash or whatever) between next / prev links when BOTH next and prev are not empty.

  1. As Vaska says, you can call the plugin with:
  2. <plugin:pagination:get_prev_next_entries />

(*forum note* the post 'Preview' button isn't working, so excuse any weird formatting)

minimum / 2013-02-16 07:58:06   

Where to I place the code to call the code to call the pagination plugin?

arsondpi / 2013-02-16 08:56:32   

Either in the text area of your exhibits or the post/pre nav area text boxes.

ph / 2013-02-17 09:26:11   

Are you sure this works. it doesn't seem to work on my web.

Can you show me an example?
Thank you very much

ph / 2013-02-17 10:40:21   

It's working!
It was a problem with the clean url's.
thks

This thread has been closed, thank you.