From 5632f6e439169797c29b49c51d527dec3fbaf370 Mon Sep 17 00:00:00 2001 From: Andrey Kuvshinov Date: Sat, 23 May 2020 11:19:00 +0300 Subject: [PATCH] add find nextpage --- app/routes/anpdf.php | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/app/routes/anpdf.php b/app/routes/anpdf.php index a93fcbf..d1ff1fa 100644 --- a/app/routes/anpdf.php +++ b/app/routes/anpdf.php @@ -308,6 +308,7 @@ function readtext_kuri($hash, $page = 1, $promo = 'no'){ } $count = $price['pages']; + $count = 24; $baseurl = '/readtext/'.$hash.'/'; $endurl = "$baseurl$count"; @@ -328,7 +329,25 @@ function readtext_kuri($hash, $page = 1, $promo = 'no'){ $content = apipage_kuri($price['price_id'], $page); - + + if ($count > $page){ + + /** предварительно сл. полоса если не пустая */ + + $nextpage = $page + 1; + + for ($p = $page + 1; $p <= $count; $p++) { + $content = apipage_kuri($price['price_id'], $p); + if (count($content) > 0){ + $nextpage = $p; + break; + } + } + + } + + $nexturl = $baseurl.$nextpage; + $tempcontent = VIEWPATH.'antext.phtml'; //подшаблон include VIEWPATH.'layout.phtml'; //центральный шаблон @@ -336,6 +355,27 @@ function readtext_kuri($hash, $page = 1, $promo = 'no'){ } +function initpageurls($page, $count, $baseurl){ + + + $res['endurl'] = "$baseurl$count"; + + if ($count > $page){ + $nextpage = $page + 1; + $res['nexturl'] = $baseurl.$nextpage; + } + + if ($page > 1) { + $prevpage = $page - 1; + $res['prevurl'] = $baseurl.$prevpage; + } + + + return $res; + +} + + function pdfscan_kuri(){