Jump to content


These Forums Are Now Read-Only


For TubePress support, please post a question here or open a support ticket and we will be glad to assist.


Photo

Can I remove the page numbers and just have Prev/Next?


  • Please log in to reply
4 replies to this topic

#1 < no first name > reed

< no first name > reed

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 27 September 2010 - 08:28 PM

Hello,

First of all, thank you for creating such a terrific plugin!

I'm having a problem that I don't quite know how to resolve on my own. I built a horizontal widget with TubePress, and it functions properly. However, I need to customize the pagination options, and that's where I get lost...

Instead of having pagination above or below the videos, I just want a 'previous' arrow on the left, and a 'next' arrow on the right. When clicked, the videos should load with AJAX, avoiding a complete page reload.

I'm building the site on my local server, so unfortunately I can't provide a link. So here's a graphic design of what I'm trying to achieve:

Posted Image

Does anyone know how I can achieve this? I would sincerely appreciate it if someone could point me in the right direction!

Thanks in advance,
Joey

#2 eric

eric

    Lead Developer

  • TubePress Staff
  • 2787 posts

Posted 29 September 2010 - 12:18 AM

Hi Joey,

The HTML for pagination is one area that TubePress isn't set up for easy customization - mostly because nobody has really asked for it before you :) I looked at the pagination code to see if it could be easily hacked to get what you're after, but my hunch is that it might be a bit messy. The problem, as I'm sure you've surmised by now, is that TubePress currently spits out the pagination as a single chunk of ( < prev ... 2 3 4 ... next > ). We'd have to teach it to separate the prev and next buttons.

Let me continue to think on it and hopefully I'll come up with a solution that will be easy to implement..

#3 eric

eric

    Lead Developer

  • TubePress Staff
  • 2787 posts

Posted 06 October 2010 - 05:41 PM

OK, I have a solution that should work. It will require a small amount of PHP coding - nothing too serious.

First, create a custom HTML template for your gallery, if you haven't already, and activate it as described here: http://tubepress.com...#html_templates.

Assuming you're starting from the default template, ui/gallery/html_templates/default.tpl.php, at line 31 you will see

<?php if (isset(${org_tubepress_template_Template::PAGINATION_TOP})) : echo ${org_tubepress_template_Template::PAGINATION_TOP}; endif; ?>
and at line 119 you will see

<?php if (isset(${org_tubepress_template_Template::PAGINATION_BOTTOM})) : echo ${org_tubepress_template_Template::PAGINATION_BOTTOM}; endif; ?>
These lines conditionally spit out the HTML for the top and bottom pagination. What we're going to do is manipulate these chunks of HTML to display only the "next" or "prev" links, instead of the whole pagination code. Regular expressions to the rescue!

Let's replace line 31 with the following:

<?php echo preg_replace('/>prev<\/([^>]+)>.*<\/div>/', '>prev</${1}></div>', ${org_tubepress_template_Template::PAGINATION_TOP}); ?>
then replace what was line 119 with the following:

<?php   echo preg_replace('/<div class="pagination">.*<([^>]+)>next<\/([^>]+)><\/div>/', '<div class="pagination"><${1}>next</${2}></div>', ${org_tubepress_template_Template::PAGINATION_TOP}); ?>

The very last step will be to position the "next" and "prev" links on the sides of your thumbnails. You could probably do that with just CSS, but if you need to move around those chunks of PHP you're free to do that as well. I've tested this code locally and it works perfectly. Just make sure you haven't disabled pagination for the gallery (otherwise you won't get any pagination!)

Let me know how this works, or if you have any trouble along the way.

#4 < no first name > reed

< no first name > reed

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 06 October 2010 - 08:15 PM

That did the trick. Thanks, Eric!

#5 Kermit Woodall

Kermit Woodall

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts

Posted 15 November 2010 - 10:00 PM

If you ever got this site online could you post the URL? I'd like to see this.

Kermit