Results 1 to 2 of 2

Thread: Pagination With get parameter

  1. #1
    Sami_ghname is offline Junior Member
    Join Date
    Feb 2010
    Posts
    12

    Default Pagination With get parameter

    Hi all,

    I have this page (articles) with form get method
    and the final result need to show in pagination page,

    when user submit the first time it's every thing work fine.
    but in the pagination link how can make link with get and send all the parameter in the first time send with the form.

    this link with pagination page
    articles/index/page/2(need the all parameter send in the first time)
    articles/index/page/3
    articles/index/page/4

    this the controller page
    public function indexAction()
    {
    $article = array();
    $dateFrom = null;
    $dateTo = null;

    if ($this->_hasParam('titleId') ){
    $titleId = $this->_getParam('titleId');
    }else{
    $titleId = $this->getFirstTitleId($this->_publisherId);
    }

    if (!$this->ifTitleExist($titleId , $this->_publisherId)){
    $this->_redirect('/articles');
    }

    if ($this->_hasParam('parsedfrom') && $this->_getParam('parsedfrom') != null ){
    $this->view->dateFrom = $this->_getParam('parsedfrom');
    $dateFrom = ( $this->is_date( $this->_getParam('parsedfrom') ) ? $this->_getParam('parsedfrom') : '00-00-0000' );
    }else{
    $this->view->dateFrom = 'Choose a Date';
    }

    if ($this->_hasParam('parsedto') && $this->_getParam('parsedto') != null ){
    $this->view->dateTo = $this->_getParam('parsedto');
    $dateTo = ( $this->is_date( $this->_getParam('parsedto') ) ? $this->_getParam('parsedto') : '99-99-9999' );
    }else{
    $this->view->dateTo = 'Choose a Date';
    }

    $titlesName = $this->getTitlesName($this->_publisherId);

    $this->view->titlesName = $titlesName;
    $this->view->titleId = $titleId;



    $articles = $this->getArticlesFrom($titleId , $dateFrom , $dateTo);

    $articleCount = 0;

    foreach ($articles as $articleRow){
    $article[$articleCount]['id'] = $articleRow['id'];
    $article[$articleCount]['headline'] = $articleRow['headline'];
    $article[$articleCount]['date'] = $articleRow['date'];
    $article[$articleCount]['parsed_on_syn'] = $this->getArticleParsed($articleRow['id']);
    $articleCount ++;
    }

    $page=$this->_getParam('page',1);
    $paginator = Zend_Paginator::factory($article);
    $paginator->setItemCountPerPage(2);
    $paginator->setPageRange(5);
    $paginator->setCurrentPageNumber($page);

    $this->view->articles = $paginator;

    }

    and this the pagination view

    <?php if ($this->last > 1){ ?>
    <div class="pagination" style="width:100%">
    <div style="float:left;width:28%">
    </div>
    <div style="float:right;width:70%;">
    <!-- First page link -->
    <?php if (isset($this->previous)): ?>
    <a href="<?php echo $this->url(array('page' => $this->first)); ?>">Start</a>
    <?php else: ?>
    <span class="disabled">Start</span>
    <?php endif; ?>

    <!-- Previous page link -->
    <?php /*
    <?php if (isset($this->previous)): ?>
    <a href="<?php echo $this->url(array('page' => $this->previous)); ?>">&lt; Previous</a>
    <?php else: ?>
    <span class="disabled">&lt; Previous</span>
    <?php endif; ?>
    *
    */
    ?>

    <!-- Numbered page links -->
    <?php foreach ($this->pagesInRange as $page): ?>
    <?php if ($page != $this->current): ?>
    <a href="<?php echo $this->url(array('page' => $page)); ?>"><?php echo $page; ?></a>
    <?php else: ?>
    <?php echo $page; ?>
    <?php endif; ?>
    <?php endforeach; ?>
    <!-- Next page link -->
    <?php /*
    <?php if (isset($this->next)): ?>
    <a href="<?php echo $this->url(array('page' => $this->next)); ?>">Next &gt;</a>
    <?php else: ?>
    <span class="disabled">Next &gt;</span>
    <?php endif; ?>
    *
    */
    ?>
    <!-- Last page link -->
    <?php if (isset($this->next)): ?>
    <a href="<?php echo $this->url(array('page' => $this->last)); ?>">End</a>
    <?php else: ?>
    <span class="disabled">End</span>
    <?php endif; ?>
    </div>
    </div>
    <?php } ?>

    and this the view page

    <?php

    echo $this->headLink()->setIndent(' ')
    ->setStylesheet($this->includeModifiedDate('/css/uitheme.css')) . "\n ";
    echo $this->headLink()->setIndent(' ')
    ->setStylesheet($this->includeModifiedDate('/css/uidatepicker.css')) . "\n ";
    echo $this->headLink()->setIndent(' ')
    ->setStylesheet($this->includeModifiedDate('/css/uicore.css')) . "\n ";



    $this->headScript()->appendFile('/js/jquery/jquery-1.3.2.min.js');
    $this->headScript()->appendFile('/js/jquery_plugins/ui.core.js');
    $this->headScript()->appendFile('/js/jquery_plugins/ui.datepicker.js')
    ?>

    <script type="text/javascript">

    $(function(){

    $('#parsedfrom').datepicker({
    presets: {specificDate: 'Parsed From'},
    dateFormat: 'yy-mm-dd'
    });
    $('#parsedto').datepicker({
    presets: {specificDate: 'Parsed To'},
    dateFormat: 'yy-mm-dd'
    });

    });
    </script>

    <body class="oneColLiqCtrHdr">

    <div id="container">
    <div id="header">

    <div class="main-menu">

    <ul>
    <li><a href="/dashboard">Dashboard</a></li>
    <li><a href="/publications">Publication</a></li>
    <li><a href="/statements">Statements</a></li>
    <li><a href="/articles">Articles</a></li>
    <li><a href="/publisher">My Information</a></li>
    <li><a href="/contacts">Contacts</a></li>
    <li><a href="/support">Support</a></li>
    <li><a href="/user/logout">Logout</a></li>
    </ul>

    </div>
    <!-- end #header --></div>
    <div id="mainContent">
    <h1>Articles For Addustor</h1>

    <form class="articles" id="articles" method="GET" action="articles">

    <fieldset>

    <div class="row">

    <label for="titleId">Publication:</label>
    <select id="titleId" name="titleId">
    <?php
    foreach ($this->titlesName as $titleName){
    $select = '';
    if($titleName['id'] == $this->titleId){ $select = 'selected'; }
    echo '<option ' . $select . ' value="' . $this->escape($titleName['id']) . '">' . $this->escape($titleName['name']) . '</option>
    ';
    }
    ?>
    </select>

    </div>



    <div class="row1">

    <label for="parsedfrom">Date From:</label>
    <input type="text" value="<?php echo $this->dateFrom ; ?>" name="parsedfrom" id="parsedfrom" />
    <div id="demoHeader" style="float: left; width: 200px;">
    </div><!-- /demoHeader -->
    <a id="dateFrom" href="javascript:void(0);">date</a>

    </div>

    <div class="row1">

    <label for="parsedto">To:</label>
    <input type="text" value="<?php echo $this->dateTo ; ?>" name="parsedto" id="parsedto" />
    <a id="dateTo" href="javascript:void(0);">date</a>

    </div>

    <div class="row1">

    <input type="submit" id="submit" name="submit" value="Submit" />

    </div>



    </fieldset>

    </form>

    <br />
    <br />
    <table class="publication">

    <thead>

    <tr>
    <th class="fullname">Headline</th>
    <th class="language">Date</th>
    <th class="passed_syn">Parsed on Syndigate</th>
    <th class="action">Actions</th>
    </tr>

    </thead>

    <tbody>

    <?php

    if (count($this->articles) ){
    foreach ($this->articles as $article){
    echo '<tr>
    <td class="name"><a href="/article?articleId=' . $this->escape($article['id']) . '">' . $this->escape($article['headline']) . '</a></td>
    <td class="language">' . $this->escape($article['date']) . '</td>
    <td class="passed_syn">' . $this->escape($article['parsed_on_syn']) . '</td>
    <td class="action"><a href="/article/reportarticle?articleId=' . $this->escape($article['id']) . '">Report Problem</a></td>
    </tr>' ;
    }
    }else {
    echo '<tr>
    <td colspan="4" style="text-align:center;">This title not have article</td>
    </tr>';
    }
    ?>

    </tbody>

    </table>

    <?php echo $this->paginationControl($this->articles, 'Sliding', 'common/pagination.phtml'); ?>



    <!-- end #mainContent --></div>
    <div id="footer">
    <p><center>Copyright © 2009 Syndigate.info</center></p>
    <!-- end #footer --></div>
    <!-- end #container --></div>
    </body>

    can any one help me

  2. #2
    Sami_ghname is offline Junior Member
    Join Date
    Feb 2010
    Posts
    12

    Default

    Nobody can help

Similar Threads

  1. Unable to bind additional parameter in Zend Pagination
    By smritiman in forum Model-View-Controller (MVC)
    Replies: 0
    Last Post: 03-16-2010, 05:26 AM
  2. Strange parameter errors
    By nandana in forum General Q&A on Zend Framework
    Replies: 2
    Last Post: 02-14-2009, 09:26 PM
  3. getting 404 with dashed parameter
    By digit in forum Model-View-Controller (MVC)
    Replies: 2
    Last Post: 11-20-2008, 06:05 PM
  4. Omit parameter name in URL
    By cheyo in forum Model-View-Controller (MVC)
    Replies: 1
    Last Post: 06-07-2008, 04:13 AM
  5. Passing a URL in a parameter
    By icedcheese in forum Model-View-Controller (MVC)
    Replies: 2
    Last Post: 10-17-2007, 06:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •