Arama butonu
Bu konudaki kullanıcılar: 1 misafir
1
Cevap
714
Tıklama
0
Öne Çıkarma
Sayfalama İleri Geri Navigasyon
Y
9 yıl
Onbaşı
Konu Sahibi

Merhaba arkadaslar ben sayfamın altına navigasyon yapıcaktımda htmlle pek olmadı js veya php ile nasıl yapabilirim bilen varmı?

< Resime gitmek için tıklayın >

ben mesela 1-2-3 die 3 sayfa oluşturdum daha sonra yeni haberler eklemek istedim bu eklicegim haberler ilk sayfaya nası gidicek biraz yardımcı olurmusun yani mesela page 1-2-3 varsa yeni ekledigim page 1 de olcak digerleri 1 sıra geri gitcek inş anlatabilmişimdir .

veyatta aşağıdaki kodları editleyip atacak varsa sevinirim bi sayfadan aldımda bu kodları sayfalama mantıgı oldugunu düşünüorum.


kod1:


<?php
require_once('SSI.php');
require_once('Portaladmin.php');

$page = !empty($_GET['page']) ? $_GET['page'] : 1;
$news = ssi_boardNews(95, 100, null,300,'array');
$pagination = new Breeze_Pagination($news, $page, '', '', 5, 5);
$pagination->PaginationArray();
$pagtrue = $pagination->PagTrue();
$data = $pagination->OutputArray();
foreach ($data as $news)
{
echo '
<div class="news_item">
<h3 class="news_header">

<a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=99319496&url=', $news['href'], '" data-href="', $news['href'], '">', $news['subject'], '</a>
</h3>
<div class="news_timestamp">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '</div>
<div class="news_body" style="padding: 2ex 0;">', $news['body'], '</div>
', $news['link'], $news['locked'] ? '' : ' | ' . $news['comment_link'], '
</div>';


echo '
<hr />';
}
echo'<br/><center>';
echo $pagination->OutputPanel();
echo'</center>';
?>

kod1 devamı:
<?php
class Breeze_Pagination
{
public function __construct($array, $page = 1, $link_prefix = false, $link_suffix = false, $limit_page = 20, $limit_number = 10)
{
if (empty($array))
$this->UsedArray = array();

else
{
$this->UsedArray = $array;
$this->Page = !empty($page) || !$limit_page ? $page : 1;
$this->LinkPrefix = !empty($link_prefix) ? $link_prefix : '';
$this->LinkSufflix = !empty($link_sufflix) ? $link_sufflix : '';
$this->LimitPage = !empty($limit_page) ? $limit_page : 20;
$this->LimitNumber = !empty($limit_number) ? $limit_number : 20;
$this->panel = '';
$this->output = array();
$this->page_cur = '';
}
}

public function PaginationArray()
{
$this->num_rows = count($this->UsedArray);

if (!$this->num_rows or $this->LimitPage >= $this->num_rows)
{
$this->pagtrue = false;
return;
}

$this->num_pages = ceil($this->num_rows / $this->LimitPage);
$this->page_offset = ($this->Page - 1) * $this->LimitPage;

/* Calculating the first number to show */
if ($this->LimitNumber)
{
$this->limit_number_start = $this->Page - ceil($this->LimitNumber / 2);
$this->limit_number_end = ceil($this->Page + $this->LimitNumber / 2) - 1;

if ($this->limit_number_start < 1)
$this->limit_number_start = 1;

//In case if the current page is at the beginning.
$this->dif = ($this->limit_number_end - $this->limit_number_start);

if ($this->dif < $this->LimitNumber)
$this->limit_number_end = $this->limit_number_end + ($this->LimitNumber - ($this->dif + 1));

if ($this->limit_number_end > $this->num_pages)
$this->limit_number_end = $this->num_pages;

//In case if the current page is at the ending.
$this->dif = ($this->limit_number_end - $this->limit_number_start);

if ($this->limit_number_start < 1)
$this->limit_number_start = 1;
}

else
{
$this->limit_number_start = 1;
$this->limit_number_end = $this->num_pages;
}

/* Let's generate the panel */
$this->GeneratePageLinks();
$this->NavigationArrows();
$this->panel = trim($this->panel);

$this->output['panel'] = $this->panel; //Panel HTML source.
$this->output['offset'] = $this->page_offset; //Current page number.
$this->output['limit'] = $this->LimitPage; //Number of resuts per page.
$this->output['array'] = array_slice($this->UsedArray, $this->page_offset, $this->LimitPage, true); //Array of current page results.

$this->pagtrue = true;
}

/* Generating page links. */
private function GeneratePageLinks()
{
for ($i = $this->limit_number_start; $i <= $this->limit_number_end; $i++)
{
$this->page_cur = '<a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=99319496&url=portal.php?page='. $this->LinkPrefix . $i . $this->LinkSufflix. '" data-href="portal.php?page='. $this->LinkPrefix . $i . $this->LinkSufflix. '">'. $i .'</a>';

if ($this->Page == $i)
$this->page_cur = '<strong>'. $i .'</strong>';

else
$this->page_cur = '<a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=99319496&url=portal.php?page='. $this->LinkPrefix . $i . $this->LinkSufflix .'" data-href="portal.php?page='. $this->LinkPrefix . $i . $this->LinkSufflix .'">'. $i .'</a>';

$this->panel .= ' <span>'. $this->page_cur .'</span>';
}
}

/* Navigation arrows. */
private function NavigationArrows()
{
if ($this->limit_number_start > 1)
$this->panel = '<strong><a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=99319496&url=portal.php?page='. $this->LinkPrefix . (1) . $this->LinkSufflix .'" data-href="portal.php?page='. $this->LinkPrefix . (1) . $this->LinkSufflix .'"><<</a> <a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=99319496&url=portal.php?page='. $this->LinkPrefix . ($this->Page - 1) . $this->LinkSufflix .'" data-href="portal.php?page='. $this->LinkPrefix . ($this->Page - 1) . $this->LinkSufflix .'"><</a></strong>'. $this->panel;

if ($this->limit_number_end < $this->num_pages)
$this->panel = $this->panel .' <strong><a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=99319496&url=portal.php?page='. $this->LinkPrefix . ($this->Page + 1) . $this->LinkSufflix .'" data-href="portal.php?page='. $this->LinkPrefix . ($this->Page + 1) . $this->LinkSufflix .'">></a> <a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=99319496&url=portal.php?page='. $this->LinkPrefix . $this->num_pages . $this->LinkSufflix .'" data-href="portal.php?page='. $this->LinkPrefix . $this->num_pages . $this->LinkSufflix .'">>></a></strong>';
}

public function OutputArray()
{
if(!empty($this->output['array']))
return $this->output['array'];

else
return false;
}

public function OutputPanel()
{
if(!empty($this->output['panel']))
return $this->output['panel'];

else
return false;
}

public function OutputOffSet()
{
if(!empty($this->output['offset']))
return $this->output['offset'];

else
return false;
}

public function OutputLimit()
{
if(!empty($this->output['limit']))
return $this->output['limit'];

else
return false;
}

public function PagTrue()
{
return $this->pagtrue;
}
}
?>



Y
9 yıl
Onbaşı
Konu Sahibi

güncel.



DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.