<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://mirmodynamics.com/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>Mirmo Dynamics - Tag - pagination</title>
  <link>http://mirmodynamics.com/</link>
  <atom:link href="http://mirmodynamics.com/feed/tag/pagination/rss2" rel="self" type="application/rss+xml"/>
  <description>Si tu kiffes pas reunoi, t'écoutes pas et puis c'est tout.</description>
  <language>en</language>
  <pubDate>Sun, 14 Mar 2010 19:59:01 +0100</pubDate>
  <copyright>2003-2009 &amp;copy; Geoffrey Bachelet</copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>New home for pagination component documentation</title>
    <link>http://mirmodynamics.com/post/2007/10/01/New-for-pagination-component-documentation</link>
    <guid isPermaLink="false">urn:md5:f869594140e39681b3570bda870b75ed</guid>
    <pubDate>Mon, 01 Oct 2007 12:44:00 +0200</pubDate>
    <dc:creator>Geoffrey</dc:creator>
        <category>Coding</category>
        <category>assembla</category><category>pagination</category><category>php</category><category>riskle</category><category>zend framework</category>    
    <description>    &lt;p&gt;For those caring, I just posted some quick documentation for &lt;a href=&quot;http://www.assembla.com/wiki/show/riskle/Pagination_Component&quot;&gt;the pagination component at my assembla space&lt;/a&gt;. More docs will follow (including extensive phpdoc docblocks I hope).&lt;/p&gt;</description>
    
    
    
          <comments>http://mirmodynamics.com/post/2007/10/01/New-for-pagination-component-documentation#comment-form</comments>
      <wfw:comment>http://mirmodynamics.com/post/2007/10/01/New-for-pagination-component-documentation#comment-form</wfw:comment>
      <wfw:commentRss>http://mirmodynamics.com/feed/atom/comments/1053</wfw:commentRss>
      </item>
    
  <item>
    <title>Bugfixes release of Zend Framework pagination component</title>
    <link>http://mirmodynamics.com/post/2007/09/30/Bugfixes-release-of-Zend-Framework-pagination-component</link>
    <guid isPermaLink="false">urn:md5:bf8dcb74b43de25d55ba962423b5a74b</guid>
    <pubDate>Sun, 30 Sep 2007 01:28:00 +0200</pubDate>
    <dc:creator>Geoffrey</dc:creator>
        <category>Coding</category>
        <category>assembla</category><category>pagination</category><category>php</category><category>riskle</category><category>zend framework</category><category>zend_db_table</category>    
    <description>    &lt;p&gt;I just released on &lt;a href=&quot;http://www.assembla.com/wiki/show/riskle&quot;&gt;riskle's assembla space&lt;/a&gt; a new version of my &lt;a href=&quot;http://www.assembla.com/wiki/show/riskle/Pagination_Component&quot;&gt;pagination component for the Zend Framework&lt;/a&gt; which you can download right now:&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;http://fashion.hosmoz.net/public/paginate-r122.tgz&quot;&gt;Riskle Paginate r122&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;This release fixes a nasty bug in &lt;code&gt;Riskle_Db_Table::fetchCols&lt;/code&gt; which prevented from retrieving the right count of cols involved in the query.&lt;/p&gt;


&lt;p&gt;The table component has also been slightly rewritten following &lt;a href=&quot;http://fashion.hosmoz.net/post/2007/09/23/Zend-Framework-Pagination-third-strike#c6892&quot;&gt;Erik's suggestion&lt;/a&gt; to move the parent mapping into &lt;code&gt;_fetch&lt;/code&gt;. The parent mapping itself has been improved to allow &amp;quot;multi level&amp;quot; table joining. This will be best explained with an example:&lt;/p&gt;


&lt;p&gt;Say you have three table, Foo, Bar and Quux, and you would like to execute the following query:&lt;/p&gt;

&lt;pre&gt;
[sql]
SELECT * FROM Foo JOIN Bar ON Foo.bar_id = Bar.id JOIN Quux ON Bar.quux_id = Quux.id
&lt;/pre&gt;


&lt;p&gt;This is now possible with the following mapping (in Foo's class of course):&lt;/p&gt;

&lt;pre&gt;
[php]
array(
    'Bar' =&amp;gt; array('local' =&amp;gt; 'bar_id', 'remote' =&amp;gt; 'id'),
    'Quux' =&amp;gt; array('local' =&amp;gt; 'quux_id', 'remote' =&amp;gt; 'Quux.id'),
);
&lt;/pre&gt;


&lt;p&gt;Easy heh ?&lt;/p&gt;


&lt;p&gt;As usual, any comments are appreciated, and please note that this code is released under the same license as the ZF itself, &lt;a href=&quot;http://framework.zend.com/license&quot;&gt;the new-bsd license&lt;/a&gt;.&lt;/p&gt;</description>
    
    
    
          <comments>http://mirmodynamics.com/post/2007/09/30/Bugfixes-release-of-Zend-Framework-pagination-component#comment-form</comments>
      <wfw:comment>http://mirmodynamics.com/post/2007/09/30/Bugfixes-release-of-Zend-Framework-pagination-component#comment-form</wfw:comment>
      <wfw:commentRss>http://mirmodynamics.com/feed/atom/comments/1050</wfw:commentRss>
      </item>
    
  <item>
    <title>Zend Framework Pagination, third strike</title>
    <link>http://mirmodynamics.com/post/2007/09/23/Zend-Framework-Pagination-third-strike</link>
    <guid isPermaLink="false">urn:md5:cd71ba5fa11c55c1e297ea7462563b80</guid>
    <pubDate>Sun, 23 Sep 2007 00:07:00 +0200</pubDate>
    <dc:creator>Geoffrey</dc:creator>
        <category>Coding</category>
        <category>assembla</category><category>pagination</category><category>php</category><category>riskle</category><category>zend framework</category><category>zend_db_table</category>    
    <description>    &lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: &lt;a href=&quot;http://fashion.hosmoz.net/post/2007/09/30/Bugfixes-release-of-Zend-Framework-pagination-component&quot;&gt;new version (r105) available&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;The component was given a little rewrite as expected, but maybe a little bit later than I would have wanted to :-) So it now has its own Rowclass proxy from which you can pull various infos such as current page, page range, next page, etc all exposed as getter methods (that is, &lt;code&gt;getCurrentPage&lt;/code&gt;, &lt;code&gt;getPageRange&lt;/code&gt;, &lt;code&gt;getNextPage&lt;/code&gt;, etc), which you won't really have to worry about since the brand new view helper will take care of that for you. Usage has changed a little, bit, so let's first have a look at what's happening from the controller point of view:&lt;/p&gt;

&lt;pre&gt;
[php]
$table = new Riskle_Db_Table_Paginate(new Table, $this-&amp;gt;_getParam('page'));
$this-&amp;gt;view-&amp;gt;rowset = $table-&amp;gt;fetchAll();
&lt;/pre&gt;


&lt;p&gt;Not much changed here, except we don't need anymore to call &lt;code&gt;getPaginationInfos()&lt;/code&gt;. Nice ! Now the big part, the view:&lt;/p&gt;

&lt;pre&gt;
[php]
$this-&amp;gt;paginate($this-&amp;gt;rowset);
echo $this-&amp;gt;paginate()-&amp;gt;previous();
echo $this-&amp;gt;paginate()-&amp;gt;navigation();
echo $this-&amp;gt;paginate()-&amp;gt;next();
&lt;/pre&gt;


&lt;p&gt;The view helper uses the neat &lt;a href=&quot;http://naneau.nl/2007/09/18/the-magic-of-view-helpers/&quot;&gt;composite helper trick from naneau&lt;/a&gt; - which is a really cool trick, great job naneau my fellow no-more-a-bunny. The first call inits the helper, feeding him the necessary rowset to work on, then you just have to call the methods you need to draw the navigation links. As you may expect, &lt;code&gt;previous&lt;/code&gt; and &lt;code&gt;next&lt;/code&gt; method will return nothing if no page is available (actually, they return their second argument, which defaults to an empty string).&lt;/p&gt;


&lt;p&gt;Also, it's worth noting that the bundled &lt;code&gt;Riskle_Db_Table&lt;/code&gt; features &lt;a href=&quot;http://fashion.hosmoz.net/post/2007/07/31/Zend_Db_Table-and-tables-relationships#c6428&quot;&gt;the patch from Erik&lt;/a&gt;, as well as a totally rewritten &lt;code&gt;fetchCols&lt;/code&gt; method (now uses a straight &lt;code&gt;Zend_Db_Select&lt;/code&gt; object instead of the ugly trick it used to use).&lt;/p&gt;


&lt;p&gt;My code is no longer available on subversion, I moved the &lt;em&gt;project&lt;/em&gt; to &lt;a href=&quot;http://www.assembla.com/&quot;&gt;assembla&lt;/a&gt;. Instead ou can download this component from the &lt;a href=&quot;http://www.assembla.com/spaces/files/riskle&quot;&gt;riskle space's files board&lt;/a&gt; (&lt;a href=&quot;http://www.assembla.com/spaces/get_file_by_id/bbKtMAAvGr3j8OabIlDkbG&quot;&gt;direct download&lt;/a&gt;), the file contains all classes needed for the component to work, just unzip it in your include_path and you're set.&lt;/p&gt;


&lt;p&gt;As usual, any comments are more than welcome.&lt;/p&gt;</description>
    
    
    
          <comments>http://mirmodynamics.com/post/2007/09/23/Zend-Framework-Pagination-third-strike#comment-form</comments>
      <wfw:comment>http://mirmodynamics.com/post/2007/09/23/Zend-Framework-Pagination-third-strike#comment-form</wfw:comment>
      <wfw:commentRss>http://mirmodynamics.com/feed/atom/comments/1039</wfw:commentRss>
      </item>
    
  <item>
    <title>Zend Framework Pagination reloaded</title>
    <link>http://mirmodynamics.com/post/2007/07/31/Zend-Framework-Pagination-reloaded</link>
    <guid isPermaLink="false">urn:md5:ff2795a69d87c7651a3e739a14720d82</guid>
    <pubDate>Tue, 31 Jul 2007 11:33:00 +0200</pubDate>
    <dc:creator>Geoffrey</dc:creator>
        <category>Coding</category>
        <category>pagination</category><category>pattern</category><category>php</category><category>proxy</category><category>zend framework</category><category>zend_db_table</category>    
    <description>    &lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;http://fashion.hosmoz.net/post/2007/09/23/Zend-Framework-Pagination-third-strike&quot;&gt;A new version of this component is available&lt;/a&gt;.&lt;/p&gt;



&lt;p&gt;I have a &lt;a href=&quot;http://svn.riskle.com/library/Riskle/Db/Table/Paginate.php&quot;&gt;new version of my pagination component&lt;/a&gt; which solve &lt;a href=&quot;http://fashion.hosmoz.net/post/2007/07/15/Pagination-with-the-Zend-Framework#c2757&quot;&gt;the issue previously pointed out&lt;/a&gt; by &lt;a href=&quot;http://totalement.geek.oupas.fr/&quot;&gt;Guy&lt;/a&gt;. This update comes along with &lt;a href=&quot;http://svn.riskle.com/library/Riskle/Db/Table.php&quot;&gt;a subclassed version of Zend_Db_Table&lt;/a&gt; which allows counting and specific columns selection respectively via the &lt;code&gt;fetchCount()&lt;/code&gt; and &lt;code&gt;fetchCols()&lt;/code&gt; methods. Btw, the &lt;code&gt;fetchCols()&lt;/code&gt; method is &lt;strong&gt;very&lt;/strong&gt; hackish at the moment, and I'll certainly end up with rewriting it using a plain &lt;code&gt;Zend_Db_Select&lt;/code&gt; statement.&lt;/p&gt;


&lt;p&gt;As always, any comment is appreciated. I'm thinking of subclassing the Rowset class to fill it with pagination info getters like &lt;code&gt;getPageCount()&lt;/code&gt;, &lt;code&gt;getNextPage()&lt;/code&gt;, etc, like in &lt;em&gt;Symfony&lt;/em&gt; for those knowing, instead of relying on a &lt;code&gt;getPaginationInfo()&lt;/code&gt; method. Future improvements will also include more view helper magic.&lt;/p&gt;


&lt;p&gt;Also, I came up with a small new &lt;code&gt;Riskle_Pattern&lt;/code&gt; namespace which I use to &lt;a href=&quot;http://svn.riskle.com/library/Riskle/Pattern/Proxy.php&quot;&gt;implement commonly used patterns&lt;/a&gt;, such as the &lt;a href=&quot;http://en.wikipedia.org/wiki/Proxy_pattern&quot;&gt;Proxy Pattern&lt;/a&gt;. I'm not yet sure of the pertinence of this thing, so any comments are yet again very much appreciated on this topic :-)&lt;/p&gt;</description>
    
    
    
          <comments>http://mirmodynamics.com/post/2007/07/31/Zend-Framework-Pagination-reloaded#comment-form</comments>
      <wfw:comment>http://mirmodynamics.com/post/2007/07/31/Zend-Framework-Pagination-reloaded#comment-form</wfw:comment>
      <wfw:commentRss>http://mirmodynamics.com/feed/atom/comments/909</wfw:commentRss>
      </item>
    
  <item>
    <title>Pagination with the Zend Framework</title>
    <link>http://mirmodynamics.com/post/2007/07/15/Pagination-with-the-Zend-Framework</link>
    <guid isPermaLink="false">urn:md5:37f240d9a3578a1a954158eb14a63b40</guid>
    <pubDate>Sun, 15 Jul 2007 11:38:00 +0200</pubDate>
    <dc:creator>Geoffrey</dc:creator>
        <category>Coding</category>
        <category>design pattern</category><category>pagination</category><category>php</category><category>proxy</category><category>view helper</category><category>zend framework</category><category>zend_db_table</category>    
    <description>    &lt;p&gt;Yesterday I came up with a small pagination component for the Zend Frameworks. It implements the &lt;a href=&quot;http://en.wikipedia.org/wiki/Proxy_pattern&quot;&gt;Proxy pattern&lt;/a&gt; around a &lt;code&gt;Zend_Db_Table&lt;/code&gt; object, and overloads the &lt;code&gt;fetchAll&lt;/code&gt; method. The main problem I encountered here was to retrieve the total number of rows for the table. I'm using a &lt;code&gt;Zend_Db_Select&lt;/code&gt; query for now, but I'll have to improve that. The component also features a view helper to draw the pagination links.&lt;/p&gt;


&lt;p&gt;You'll find the code for the &lt;a href=&quot;http://svn.riskle.com/library/Riskle/Db/Table/Paginate.php&quot;&gt;component&lt;/a&gt; and the &lt;a href=&quot;http://svn.riskle.com/library/Riskle/View/Helper/Paginate.php&quot;&gt;view helper&lt;/a&gt; on my &lt;acronym&gt;SVN&lt;/acronym&gt;.&lt;/p&gt;


&lt;p&gt;And here is how it is used in the controller:&lt;/p&gt;

&lt;pre&gt;
    public function indexAction() {
        $urls = new Riskle_Db_Table_Paginate(new Urls, $this-&amp;gt;_getParam('page'));
        $this-&amp;gt;view-&amp;gt;urlsList = $urls-&amp;gt;fetchAll(null, 'datetime DESC');
        $this-&amp;gt;view-&amp;gt;paginationInfos = $urls-&amp;gt;getPaginationInfos();
    }
&lt;/pre&gt;


&lt;p&gt;The view helper takes &lt;code&gt;paginationInfos&lt;/code&gt; as an argument:&lt;/p&gt;

&lt;pre&gt;
echo $this-&amp;gt;paginate($this-&amp;gt;paginationInfos);
&lt;/pre&gt;


&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;


&lt;p&gt;As pointed out by &lt;a href=&quot;http://totalement.geek.oupas.fr/&quot;&gt;Guy&lt;/a&gt;, the &lt;code&gt;_getPageCount&lt;/code&gt; method does not actually takes care of the &lt;code&gt;$where&lt;/code&gt; condition, thus rendering the class inefficient as getting the real totel number of items. This issue will be adressed in an upcoming version of the class :-)&lt;/p&gt;


&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;


&lt;p&gt;There's an &lt;a href=&quot;http://fashion.hosmoz.net/post/2007/07/31/Zend-Framework-Pagination-reloaded&quot;&gt;updated version of this component&lt;/a&gt; available.&lt;/p&gt;</description>
    
    
    
          <comments>http://mirmodynamics.com/post/2007/07/15/Pagination-with-the-Zend-Framework#comment-form</comments>
      <wfw:comment>http://mirmodynamics.com/post/2007/07/15/Pagination-with-the-Zend-Framework#comment-form</wfw:comment>
      <wfw:commentRss>http://mirmodynamics.com/feed/atom/comments/889</wfw:commentRss>
      </item>
    
</channel>
</rss>