add auto mobile version
This commit is contained in:
@@ -3,7 +3,8 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php":">=5.3.0",
|
"php":">=5.3.0",
|
||||||
"masterforweb/kuri":"dev-master",
|
"masterforweb/kuri":"dev-master",
|
||||||
"masterforweb/db_lite":"dev-master"
|
"masterforweb/db_lite":"dev-master",
|
||||||
|
"mobiledetect/mobiledetectlib": "^2.8"
|
||||||
},
|
},
|
||||||
"repositories":[
|
"repositories":[
|
||||||
|
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ function bookmark_set($hash, $page){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function promo_kuri($hash, $page = 0, $promo = true){
|
function promo_kuri($hash, $page = 0, $promo = true, $device = null){
|
||||||
|
|
||||||
# test url http://klan.dv/promo/bac343b41b357fdc8243373a429caa62 (742.pdf source)
|
# test url http://klan.dv/promo/bac343b41b357fdc8243373a429caa62 (742.pdf source)
|
||||||
|
|
||||||
@@ -194,10 +194,11 @@ function promo_kuri($hash, $page = 0, $promo = true){
|
|||||||
if ($page == 0){ // не читал ли ранее
|
if ($page == 0){ // не читал ли ранее
|
||||||
$page = 1; //если нет страницы то первая
|
$page = 1; //если нет страницы то первая
|
||||||
if ($bookmark !== false and $bookmark > 1){
|
if ($bookmark !== false and $bookmark > 1){
|
||||||
return promo_kuri($hash, $bookmark, $promo);
|
return promo_kuri($hash, $bookmark, $prom, $device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//устанавливаем закладку
|
//устанавливаем закладку
|
||||||
bookmark_set($hash, $page);
|
bookmark_set($hash, $page);
|
||||||
|
|
||||||
@@ -222,6 +223,20 @@ function promo_kuri($hash, $page = 0, $promo = true){
|
|||||||
$count = $price['pages'];
|
$count = $price['pages'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($device == null){
|
||||||
|
$detect = new Mobile_Detect;
|
||||||
|
if ( $detect->isMobile() ) {
|
||||||
|
$device = 'mobile';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$device = 'desktop';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//мобильная версия
|
||||||
|
if ($device == 'mobile')
|
||||||
|
return readtext_kuri($hash, $page);
|
||||||
|
|
||||||
|
|
||||||
$pdfile = $data['pdfpgurl'];
|
$pdfile = $data['pdfpgurl'];
|
||||||
$fullpdf = $data['pdfurl'];
|
$fullpdf = $data['pdfurl'];
|
||||||
@@ -277,7 +292,7 @@ function promo_kuri($hash, $page = 0, $promo = true){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function textpdf_kuri($hash, $page = 1){
|
function readtext_kuri($hash, $page = 1){
|
||||||
|
|
||||||
$price = api_pricehash($hash);
|
$price = api_pricehash($hash);
|
||||||
|
|
||||||
@@ -285,7 +300,24 @@ function textpdf_kuri($hash, $page = 1){
|
|||||||
return 'page not found';
|
return 'page not found';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$count = $price['pages'];
|
||||||
|
$baseurl = '/readtext/'.$hash.'/';
|
||||||
|
$endurl = "$baseurl$count";
|
||||||
|
|
||||||
|
|
||||||
|
if ($count > $page){
|
||||||
|
$nextpage = $page + 1;
|
||||||
|
$nexturl = $baseurl.$nextpage;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($page > 1) {
|
||||||
|
$prevpage = $page - 1;
|
||||||
|
$prevurl = $baseurl.$prevpage;
|
||||||
|
}
|
||||||
|
|
||||||
$title = $price['pricename'];
|
$title = $price['pricename'];
|
||||||
|
$newcurr = strtotime($price['BeginDate']);
|
||||||
|
|
||||||
$content = apipage_kuri($price['price_id'], $page);
|
$content = apipage_kuri($price['price_id'], $page);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,37 @@
|
|||||||
|
<script>
|
||||||
|
var newcurr = '<?=$newcurr?>',
|
||||||
|
baseurl ='<?=$baseurl?>',
|
||||||
|
nexturl = '<?=$nexturl?>',
|
||||||
|
newcurr ='<?=$newcurr?>',
|
||||||
|
prevurl = '<?=$prevurl?>';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?include ('blocks/pgtextnav.phtml')?>
|
||||||
|
|
||||||
<div id="an_text_block">
|
<div id="an_text_block">
|
||||||
<div id=""></div>
|
|
||||||
|
<?if (count($content) > 0):?>
|
||||||
|
|
||||||
<?foreach($content as $news):?>
|
<?foreach($content as $news):?>
|
||||||
<h2 class="antitle"><?=$news['title']?></h2>
|
<h2 class="antitle"><?=$news['title']?></h2>
|
||||||
<?if ($news['img'] !== ''):?>
|
<?if ($news['img'] !== ''):?>
|
||||||
<figure class="anphoto">
|
<figure class="anphoto">
|
||||||
|
<?if (in_array($news['img'], ['jpg', 'png', 'gif', 'jpeg', 'JPG'])):?>
|
||||||
|
<img src="https://imgurl.argumenti.ru/news/news_id/<?=$news['news_id']?>.<?=$news['img']?>" />
|
||||||
|
<?else:?>
|
||||||
<img src="https://imgurl.argumenti.ru/news/news_id/<?=$news['img']?>" />
|
<img src="https://imgurl.argumenti.ru/news/news_id/<?=$news['img']?>" />
|
||||||
|
<?endif?>
|
||||||
</figure>
|
</figure>
|
||||||
<?endif?>
|
<?endif?>
|
||||||
<div class="antext"><?=$news['text']?></div>
|
<div class="antext"><?=$news['text']?></div>
|
||||||
<?endforeach?>
|
<?endforeach?>
|
||||||
|
<?else:?>
|
||||||
|
<p>Данная страница недоступна в мобильной версии</p>
|
||||||
|
<p>Перейдите на <a href="<?=$nexturl?>">следующую страницу</a></p>
|
||||||
|
<?endif?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?include ('blocks/pgtextnav.phtml')?>
|
||||||
|
|
||||||
|
|||||||
33
app/views/blocks/pgtextnav.phtml
Normal file
33
app/views/blocks/pgtextnav.phtml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<div id="stuff-bar">
|
||||||
|
<div id="pagenav">
|
||||||
|
|
||||||
|
<?if (isset($prevurl)):?>
|
||||||
|
<div class="firstpage">
|
||||||
|
<a href="<?=$baseurl?>1">
|
||||||
|
<i class="fas fa-angle-double-left"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="navpage"><a href="<?=$prevurl?>"><i class="fas fa-chevron-circle-left"></i></a></div>
|
||||||
|
<?endif?>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="currpage">
|
||||||
|
<select id="pages" onchange="changepage()">
|
||||||
|
<?for ($i = 1; $i <= $count; $i++):?>
|
||||||
|
<?$selected = ($page == $i) ? ' selected' : ''?>
|
||||||
|
<option value="<?=$i?>"<?=$selected?>><?=$i?></option>
|
||||||
|
<?endfor?>
|
||||||
|
</select>
|
||||||
|
<i class="fas fa-chevron-down"></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?if (isset($nexturl)):?>
|
||||||
|
<div class="navpage"><a href="<?=$nexturl?>"><i class="fas fa-chevron-circle-right"></i></a></div>
|
||||||
|
<?if (isset($endurl)):?>
|
||||||
|
<div class="navpage"><a href="<?=$endurl?>"><i class="fas fa-angle-double-right"></i></a></div>
|
||||||
|
<?endif?>
|
||||||
|
<?endif?>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user