<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Pagination on Outweb</title><link>https://outweb.eu/tags/pagination/</link><description>Recent content in Pagination on Outweb</description><image><title>Outweb</title><url>https://outweb.eu/images/seo/outweb-default-og.svg</url><link>https://outweb.eu/images/seo/outweb-default-og.svg</link></image><generator>Hugo</generator><language>fr-FR</language><lastBuildDate>Wed, 08 Jun 2011 09:45:58 +0000</lastBuildDate><atom:link href="https://outweb.eu/tags/pagination/feed.xml" rel="self" type="application/rss+xml"/><item><title>Système de pagination sous CodeIgniter</title><link>https://outweb.eu/2011/06/08/systeme-de-pagination-sous-codeigniter/</link><pubDate>Wed, 08 Jun 2011 09:45:58 +0000</pubDate><guid isPermaLink="false">https://outweb.eu/2011/06/08/systeme-de-pagination-sous-codeigniter/</guid><description>&lt;p>Avec Codigniter vous pouvez mettre en place simplement un système de pagination pour afficher vos informations par paquets. Tout cela sans se prendre la tête et se noyer dans des dizaines de lignes de code.&lt;/p>
&lt;p>Nous allons créer la base de donnée de l&amp;rsquo;article : &lt;a href="https://outweb.eu/2011/06/04/installation-et-configuration-de-codeigniter/">Installation et Configuration de CodeIgniter&lt;/a> .&lt;/p>
&lt;p>Dans un premier temps il créer le model. Pour cela nous allons utiliser la classe active record de CodeIgniter.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-gdscript3" data-lang="gdscript3">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">class&lt;/span> model &lt;span style="color:#66d9ef">extends&lt;/span> CI_Model {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> function __construct()
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">//&lt;/span> Call the Model constructor
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> parent::__construct();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> public function getAll(&lt;span style="color:#f92672">$&lt;/span>debut&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#ae81ff">0&lt;/span>) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> &lt;span style="color:#f92672">$&lt;/span>this&lt;span style="color:#f92672">-&amp;gt;&lt;/span>db&lt;span style="color:#f92672">-&amp;gt;&lt;/span>select(&lt;span style="color:#e6db74">&amp;#39;*&amp;#39;&lt;/span>)&lt;span style="color:#f92672">-&amp;gt;&lt;/span>from(&lt;span style="color:#e6db74">&amp;#39;message&amp;#39;&lt;/span>)&lt;span style="color:#f92672">-&amp;gt;&lt;/span>order_by(&lt;span style="color:#e6db74">&amp;#34;id&amp;#34;&lt;/span>, &lt;span style="color:#e6db74">&amp;#34;desc&amp;#34;&lt;/span>)&lt;span style="color:#f92672">-&amp;gt;&lt;/span>limit(&lt;span style="color:#ae81ff">30&lt;/span>, &lt;span style="color:#f92672">$&lt;/span>debut)&lt;span style="color:#f92672">-&amp;gt;&lt;/span>get()&lt;span style="color:#f92672">-&amp;gt;&lt;/span>result();
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> public function count(&lt;span style="color:#f92672">$&lt;/span>where &lt;span style="color:#f92672">=&lt;/span> array()) {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#66d9ef">return&lt;/span> (&lt;span style="color:#a6e22e">int&lt;/span>) &lt;span style="color:#f92672">$&lt;/span>this&lt;span style="color:#f92672">-&amp;gt;&lt;/span>db&lt;span style="color:#f92672">-&amp;gt;&lt;/span>where(&lt;span style="color:#f92672">$&lt;/span>where)&lt;span style="color:#f92672">-&amp;gt;&lt;/span>count_all_results(&lt;span style="color:#e6db74">&amp;#39;message&amp;#39;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Puis nous allons créer notre contrôleur.&lt;/p></description></item></channel></rss>