Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [MOD] New paginator  (Read 1403 times)

Palmik

  • Jr. Member
  • **
  • Karma: 2
  • Posts: 58
    • Palmik's Page
[MOD] New paginator
« on: November 11, 2007, 11:30:37 am »

I think it would be nice to have paginator with some select. So i rewrite function paginator to this:
Code: [Select]
// PAGINATOR
function paginator($category, $pageNum, $maxPage, $article, $pagePrefix) {
$link = ' <a href="'.db('website').$category.'/';
if (!empty($article)) {$link .= $article.'/';}
$prefix = !empty($pagePrefix) ? $pagePrefix : '';

        echo '<select name="pages" size="1">';           
            for ($xyz=1; $xyz <= $maxPage; $xyz++) {
                echo '<option value = "' .$xyz. '">' .$xyz. '</option>';
            }
        echo '<input type="submit" value="Jdi">';
}

But I need some help because I am not good with php.
So what I need?
I dunno how to make it to go to the page if somebody push the button
Somebody can help me? :)
« Last Edit: November 26, 2007, 11:15:02 pm by piXelatedEmpire »
Logged

Palmik

  • Jr. Member
  • **
  • Karma: 2
  • Posts: 58
    • Palmik's Page
Re: [MOD] New paginator
« Reply #1 on: November 11, 2007, 12:05:34 pm »

Sorry I post here wrong function :D
It should be OK now, but I still need help :)
Logged

Palmik

  • Jr. Member
  • **
  • Karma: 2
  • Posts: 58
    • Palmik's Page
Re: [MOD_HELP] New paginator
« Reply #2 on: November 12, 2007, 05:37:29 pm »

Ok,
It would be better if I put here some image how does it should look like.
So, here is it. :)
I hope someone help me.
Logged

Palmik

  • Jr. Member
  • **
  • Karma: 2
  • Posts: 58
    • Palmik's Page
Re: [MOD_HELP] New paginator
« Reply #3 on: November 22, 2007, 08:06:26 pm »

OK, here is it... complete and working,
Code: [Select]
// PAGINATOR
function paginator($category, $pageNum, $maxPage, $article, $pagePrefix) {
$link = ' <a href="'.db('website').$category.'/';
if (!empty($article)) {$link .= $article.'/';}
$prefix = !empty($pagePrefix) ? $pagePrefix : '';
echo l('go_on_page');
        echo '

         <select size="1" onchange="location.href=this.value;" name="pages">';           
            for ($xyz=1; $xyz <= $maxPage; $xyz++) {
                echo '<option value = "'.db('website').'home/p_' .$xyz. '/" class="option_page">' .$xyz. '</option>';
            }
        echo '        </select>
';
}
« Last Edit: November 23, 2007, 01:57:52 pm by Palmik »
Logged