Hi, this week, using jquery, php, ajax and we will do the paging and data capture, Ajax paging and paging with Ajax examples here will tell us.
While this writer Erin muharrem “kgpager” and we used Ezsql class,
Online test: here
Click here to download …
Turkish Text :
Merhabalar , bu hafta jquery ve php kullanarak ,ajax ile sayfalandırma ve bilgi çekmeyi yapacağız, Ajax sayfalama ve ajax ile sayfalama örneğimizi burada anlatacağım.
bunu yazarken muharrem Erin “kgpager” ve Ezsql sınıfını kullandık ,
Online test:için Buraya tıklayınız
İndirmek için buraya tıklayınız
[dm]103[/dm]
index.php
STNC AJAX PAGING--selman tunç
<!--
#content_ ul {
background-color:#000;
height:30px;
list-style:none outside none;
margin:10px 0;
padding:0 0 0 50px;
}#content_ ul li {
color:#FFFFFF;
float:left;
font:bold 14px Georgia,"Times New Roman",Times,serif;
padding:5px 10px 0;
}
-->
<!---->
get_var("SELECT count(Id) FROM news");
$kgPagerOBJ = & new kgPager();
$kgPagerOBJ->pager_set($pager_url, $total_records, $scroll_page, $per_page, $current_page, $inactive_page_tag, $previous_page_text, $next_page_text, $first_page_text, $last_page_text, $pager_url_last);
$sql = "SELECT * from news ORDER BY Id asc limit ".$kgPagerOBJ->start.", ".$kgPagerOBJ->per_page;
$contents = $db->get_results($sql, ARRAY_A);
if ($contents != '') {
foreach ($contents as $content) {
echo ''.$content['news'].'';
echo'
';
echo $content['news'];
echo'
';
}
}
else
{
echo 'notting value sorry';
}
echo '';
echo $kgPagerOBJ->first_page;
echo $kgPagerOBJ->previous_page;
echo $kgPagerOBJ->page_links;
echo $kgPagerOBJ->next_page;
echo $kgPagerOBJ->last_page;
echo '
';
?>
ajax_comment.php
get_var("SELECT count(Id) FROM news");
$kgPagerOBJ = & new kgPager();
$kgPagerOBJ->pager_set($pager_url, $total_records, $scroll_page, $per_page, $current_page, $inactive_page_tag, $previous_page_text, $next_page_text, $first_page_text, $last_page_text, $pager_url_last);
$sql = "SELECT * from news ORDER BY Id asc limit ".$kgPagerOBJ->start.", ".$kgPagerOBJ->per_page;
$contents = $db->get_results($sql, ARRAY_A);
if ($contents != '') {
foreach ($contents as $content) {
echo ''.$content['news'].'';
echo'
';
echo $content['news'];
echo'
';
}
}
else
{
echo 'notting value sorry';
}
echo '';
echo $kgPagerOBJ->first_page;
echo $kgPagerOBJ->previous_page;
echo $kgPagerOBJ->page_links;
echo $kgPagerOBJ->next_page;
echo $kgPagerOBJ->last_page;
echo '
';
config.php
query("set SESSION character_set_client = ".LNG_NAME."");
$db->query("set SESSION character_set_connection = ".LNG_NAME."");
$db->query("SET CHARACTER SET ".LNG_NAME."");
$db->query("SET COLLATION_CONNECTION = '".LNG_OPTIONS."'");
if (isset($_GET['page']) && is_numeric($_GET['page']))
$page = $_GET['page'];
else
$page = false;
$link_label = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "page") == false )
{
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$link_label = "&" . htmlentities(implode("&", $newParams));
}
}
//paging conf
$scroll_page = 5; // paging
$per_page = 5; // page total
$current_page = $_GET['page'];
$pager_url = $_SERVER["PHP_SELF"].'?page=';
$inactive_page_tag = 'id="current_page"';
$previous_page_text = ' $next_page_text = 'next page >';
$first_page_text = ' $last_page_text = 'last page >>';
$pager_url_last =$link_label;
?>