Friday, February 6, 2015

pagination (style, php)


 style of page navigation

.navp{ margin-left:5px}
.navp a{background:‪#‎CCC‬; border-radius:3px; padding: 7px 7px; margin-left:1px; margin-top:10px; display:inline-block;color:‪#‎fd792a‬}
.navp{ width:500px; clear:both;}
.navp span{ background:#CCC; border-radius:3px; padding: 7px 7px; margin-left:1px; margin-top:10px; display:inline-block;}

php and html of page navigation

/// start pagenation
if (isset($_GET['start'])){
$start=$_GET['start'];
}
else{
$start=0;
}

if(isset($_GET['start1'])){
$url="&start1=".$_GET['start1'];
}
else{
$url='';
}

if(isset($_GET['id'])){
$page_name="?page=".$get_alias."&pid=0&id=".$_GET['id']."&l=true".$url;
}

if(strlen($start) > 0 and !is_numeric($start)){
$start=0;
}

if(isset($_GET['id'])){
$model0=new Model();
$sql=$model0->Select("count(content_id) as amount","tbadmin_content","is_active=1 and parent_id=289");
}

if(isset($_GET['id'])){
while($row0=$sql->fetch_array()){
$nume=$row0["amount"];
}
if(($start-0)>$nume)
$start= 0;
$eu = ($start -0);
$limit = 2;
$this1 = $eu + $limit;
$back = $eu - $limit;
$next = $eu + $limit;
}
$model=new Model();
if(isset($_GET['id'])){
$content1=$model->Select("*","tbadmin_content","is_active=1 and parent_id=289 order by content_id desc limit {$eu}, {$limit}");
}
else{
if(isset($_GET['id'])){
$content1=$model->Select("*","tbadmin_content","is_active=1 and parent_id=289"." limit {$eu}, {$limit}");
}
}
if(isset($_GET['page']) && isset($_GET['pid']) && ($_GET['pid']==0) && $_GET['id']!=""){
while($row1=$content1->fetch_array()){

if(strlen($row1['short_description'])>100)
{
$dot='...';
}
else{
$dot='';
}
echo '




'.$row1['menu_text'].'



'.substr($row1['short_description'],0,100).$dot.'
';
if(strlen($row1['short_description'])>100){
echo 'Read more';}
echo '
';
}

echo '
';
////end of pagenation
}
?

No comments:

Post a Comment