Постраничная навигация - Visavi.net https://visavi.net/ RSS - Visavi.net https://visavi.net/assets/img/images/logo_small.png RSS - Visavi.net https://visavi.net/ [email protected] (admin) [email protected] (admin) Mon, 02 Dec 2024 19:49:13 +0300 <a href="http://www.tigir.com/paging.htm" target="_blank" rel="nofollow">http://www.tigir.com/paging.htm</a> https://visavi.net/topics/40474/661704 Постраничная навигация ____________________ Fri, 11 Apr 2014 09:16:40 +0400 Messages https://visavi.net/topics/40474/661704 <pre class="prettyprint"> $this-&gt;app-&gt;exists(&#039;text_prev&#039;) ? &#039;&#039; &#58; $this-&gt;app-&gt;set(&#039;text_prev&#039;, &quot;Вперед на &quot;.$this-&gt;app-&gt;get(&quot;news&quot;).&quot; публикаций&lt;strong style=\&quot;font-size&#58; 20px;\&quot;&gt;&amp;nbsp;&amp;#8594;&lt;/strong&gt;&lt;/a&gt;&quot;); $this-&gt;app-&gt;exists(&#039;text_next&#039;) ? &#039;&#039; &#58; $this-&gt;app-&gt;set(&#039;text_next&#039;, &quot;&lt;strong style=\&quot;font-size&#58; 20px;\&quot;&gt;&amp;#8592;&amp;nbsp;&lt;/strong&gt;Назад на &quot;.$this-&gt;app-&gt;get(&quot;news&quot;).&quot; публикаций&lt;/a&gt;&quot;); if(!$this-&gt;app-&gt;exists(&#039;admin_panel&#039;)) { $link&#91;&#039;inc&#039;] = &quot;&lt;a href=&#039;/category/&quot;.$category_id.&quot;/&quot;.($this-&gt;app-&gt;get(&#039;PARAMS.page&#039;)+1).&quot;/&#039;&gt;&quot;.$this-&gt;app-&gt;get(&#039;text_next&#039;); $link&#91;&#039;dec&#039;] = &quot;&lt;a href=&#039;/category/&quot;.$category_id.&quot;/&quot;.($this-&gt;app-&gt;get(&#039;PARAMS.page&#039;)-1).&quot;/&#039;&gt;&quot;.$this-&gt;app-&gt;get(&#039;text_prev&#039;); } else { $link&#91;&#039;inc&#039;] = &quot;&lt;a href=&#039;&quot;.$this-&gt;app-&gt;get(&#039;admin_panel&#039;).&quot;&quot;.($this-&gt;app-&gt;get(&#039;PARAMS.page&#039;)+1).&quot;/&#039;&gt;&quot;.$this-&gt;app-&gt;get(&#039;text_next&#039;); $link&#91;&#039;dec&#039;] = &quot;&lt;a href=&#039;&quot;.$this-&gt;app-&gt;get(&#039;admin_panel&#039;).&quot;&quot;.($this-&gt;app-&gt;get(&#039;PARAMS.page&#039;)-1).&quot;/&#039;&gt;&quot;.$this-&gt;app-&gt;get(&#039;text_prev&#039;); } $this-&gt;app-&gt;get(&#039;DB&#039;)-&gt;exec( $query, $query_params&#91;&#039;inc&#039;]); if($this-&gt;app-&gt;get(&#039;DB&#039;)-&gt;count() != NULL) $this-&gt;app-&gt;set(&quot;next_page&quot;, $link&#91;&#039;inc&#039;]); $this-&gt;app-&gt;get(&#039;DB&#039;)-&gt;exec( $query, $query_params&#91;&#039;dec&#039;]); if($this-&gt;app-&gt;get(&#039;DB&#039;)-&gt;count() != NULL) $this-&gt;app-&gt;set(&quot;prev_page&quot;, $link&#91;&#039;dec&#039;]); } } </pre> https://visavi.net/topics/40474/661702 Постраничная навигация YouMobe Fri, 11 Apr 2014 08:43:01 +0400 Messages https://visavi.net/topics/40474/661702 не могу сделать навигацию по такому шаблону &lt;&lt;&lt; 1,2,3,<strong>4</strong>,5,6 &gt;&gt;&gt;<br> <pre class="prettyprint"> private function get_navigation_menu($app) { $app-&gt;set(&quot;menu&quot;, $app-&gt;get(&#039;DB&#039;)-&gt;exec(&quot;SELECT * FROM `categories`&quot;)); $app-&gt;set(&quot;static_page&quot;, $app-&gt;get(&#039;DB&#039;)-&gt;exec(&quot;SELECT * FROM `static_page`&quot;)); } public function pagination($table=&#039;posts&#039;) { $current_page = $this-&gt;app-&gt;get(&#039;PARAMS.page&#039;)-1; #переменная news - находится в конфиге -_- news = количество новостей на страницу. $next_page = (1+$current_page) * $this-&gt;app-&gt;get(&quot;news&quot;); $prev_page = ($current_page-1) * $this-&gt;app-&gt;get(&quot;news&quot;); if($table == &#039;posts&#039;) { $category_id = $this-&gt;app-&gt;get(&#039;PARAMS.id_category&#039;); if($this-&gt;app-&gt;get(&quot;admin_panel&quot;)) { $query = &quot;SELECT `id` FROM `posts` ORDER BY `id` desc LIMIT ?,?&quot;; $query_params&#91;&#039;inc&#039;] = array( 1 =&gt; $next_page, 2 =&gt; $this-&gt;app-&gt;get(&#039;news&#039;) ); $query_params&#91;&#039;dec&#039;] = array( 1 =&gt; $prev_page, 2 =&gt; $this-&gt;app-&gt;get(&#039;news&#039;) ); } else { $query = &quot;SELECT `id` FROM `posts` WHERE `category_id` = ? ORDER BY `id` desc LIMIT ?,?&quot;; #Только для удобочитаемости, я не про форматирование текста =_= $query_params&#91;&#039;inc&#039;] = array( 1 =&gt; $this-&gt;app-&gt;get(&#039;PARAMS.id_category&#039;), 2 =&gt; $next_page, 3 =&gt; $this-&gt;app-&gt;get(&#039;news&#039;) ); $query_params&#91;&#039;dec&#039;] = array( 1 =&gt; $this-&gt;app-&gt;get(&#039;PARAMS.id_category&#039;), 2 =&gt; $prev_page, 3 =&gt; $this-&gt;app-&gt;get(&#039;news&#039;) ); } } else { $category_id = $table; $query = &quot;SELECT `id` FROM $table ORDER BY `id` desc LIMIT ?,?&quot;; $query_params&#91;&#039;inc&#039;] = array( 1 =&gt; $next_page, 2 =&gt; $this-&gt;app-&gt;get(&#039;news&#039;) ); $query_params&#91;&#039;dec&#039;] = array( 1 =&gt; $prev_page, 2 =&gt; $this-&gt;app-&gt;get(&#039;news&#039;) ); } </pre> https://visavi.net/topics/40474/661701 Постраничная навигация YouMobe Fri, 11 Apr 2014 08:40:59 +0400 Messages https://visavi.net/topics/40474/661701