Постраничная навигация - 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->app->exists('text_prev') ? '' : $this->app->set('text_prev', "Вперед на ".$this->app->get("news")." публикаций<strong style=\"font-size: 20px;\">&nbsp;&#8594;</strong></a>");
$this->app->exists('text_next') ? '' : $this->app->set('text_next', "<strong style=\"font-size: 20px;\">&#8592;&nbsp;</strong>Назад на ".$this->app->get("news")." публикаций</a>");
if(!$this->app->exists('admin_panel'))
{
$link['inc'] = "<a href='/category/".$category_id."/".($this->app->get('PARAMS.page')+1)."/'>".$this->app->get('text_next');
$link['dec'] = "<a href='/category/".$category_id."/".($this->app->get('PARAMS.page')-1)."/'>".$this->app->get('text_prev');
}
else
{
$link['inc'] = "<a href='".$this->app->get('admin_panel')."".($this->app->get('PARAMS.page')+1)."/'>".$this->app->get('text_next');
$link['dec'] = "<a href='".$this->app->get('admin_panel')."".($this->app->get('PARAMS.page')-1)."/'>".$this->app->get('text_prev');
}
$this->app->get('DB')->exec(
$query,
$query_params['inc']);
if($this->app->get('DB')->count() != NULL)
$this->app->set("next_page", $link['inc']);
$this->app->get('DB')->exec(
$query,
$query_params['dec']);
if($this->app->get('DB')->count() != NULL)
$this->app->set("prev_page", $link['dec']);
}
}
</pre>
https://visavi.net/topics/40474/661702
Постраничная навигация
YouMobe
Fri, 11 Apr 2014 08:43:01 +0400
Messages
https://visavi.net/topics/40474/661702
-
не могу сделать навигацию по такому шаблону <<< 1,2,3,<strong>4</strong>,5,6 >>><br>
<pre class="prettyprint">
private function get_navigation_menu($app)
{
$app->set("menu", $app->get('DB')->exec("SELECT * FROM `categories`"));
$app->set("static_page", $app->get('DB')->exec("SELECT * FROM `static_page`"));
}
public function pagination($table='posts')
{
$current_page = $this->app->get('PARAMS.page')-1;
#переменная news - находится в конфиге -_- news = количество новостей на страницу.
$next_page = (1+$current_page) * $this->app->get("news");
$prev_page = ($current_page-1) * $this->app->get("news");
if($table == 'posts')
{
$category_id = $this->app->get('PARAMS.id_category');
if($this->app->get("admin_panel"))
{
$query = "SELECT `id` FROM `posts` ORDER BY `id` desc LIMIT ?,?";
$query_params['inc'] = array(
1 => $next_page,
2 => $this->app->get('news')
);
$query_params['dec'] = array(
1 => $prev_page,
2 => $this->app->get('news')
);
}
else
{
$query = "SELECT `id` FROM `posts` WHERE `category_id` = ? ORDER BY `id` desc LIMIT ?,?";
#Только для удобочитаемости, я не про форматирование текста =_=
$query_params['inc'] = array(
1 => $this->app->get('PARAMS.id_category'),
2 => $next_page,
3 => $this->app->get('news')
);
$query_params['dec'] = array(
1 => $this->app->get('PARAMS.id_category'),
2 => $prev_page,
3 => $this->app->get('news')
);
}
}
else
{
$category_id = $table;
$query = "SELECT `id` FROM $table ORDER BY `id` desc LIMIT ?,?";
$query_params['inc'] = array(
1 => $next_page,
2 => $this->app->get('news')
);
$query_params['dec'] = array(
1 => $prev_page,
2 => $this->app->get('news')
);
}
</pre>
https://visavi.net/topics/40474/661701
Постраничная навигация
YouMobe
Fri, 11 Apr 2014 08:40:59 +0400
Messages
https://visavi.net/topics/40474/661701