kriptofermer Posted January 10, 2010 Report Share Posted January 10, 2010 Здравствуйте, разбираюсь с триальной версией системы для использования ее в проекте интернет-магазина. Столкнулся со следующей проблемой - как сделать вывод определенного количества новостей, к примеру 7, на главной странице? По умолчанию выводится, если не ошибаюсь, только 4. Quote Link to post Share on other sites
Guest Posted January 11, 2010 Report Share Posted January 11, 2010 Число выводимых новостей настраивается в файле Site.class.php:var $articles_count = 5; // Количество свежих статейvar $news_count = 5; // Количество свежих новостей Quote Link to post Share on other sites
kriptofermer Posted January 13, 2010 Author Report Share Posted January 13, 2010 Спасибо, вопрос закрыт! Quote Link to post Share on other sites
kriptofermer Posted March 24, 2011 Author Report Share Posted March 24, 2011 Вопрос по количеству выводимых статей / новостей, но уже касаемо внутренних разделов /news и /articles, в каком файле задается количество выводимых статей / новостей на странице самого раздела?Заранее спасибо. Quote Link to post Share on other sites
Kosjak76 Posted March 24, 2011 Report Share Posted March 24, 2011 Выводятся ВСЕ статьи и новости Quote Link to post Share on other sites
Noxter Posted March 24, 2011 Report Share Posted March 24, 2011 Файл Articles.class.php строка 60 заменитеorder_num DESC'); на order_num DESC LIMIT 1');Точно так же и с файлом NewsLine.class.phpLIMIT 1 это и есть количество выводимых материалов. Quote Link to post Share on other sites
mart Posted March 24, 2011 Report Share Posted March 24, 2011 Завтра выложу статью по этому вопросу к себе в блог... Делал уже для 1 проекта. Quote Link to post Share on other sites
Noxter Posted March 24, 2011 Report Share Posted March 24, 2011 martА мой вариант, что не подходит разве?По-моему самый простой вариант, правда можно еще и в админке сделать чтобы можно было выставлять количество, но это будет лишним. Quote Link to post Share on other sites
mart Posted March 25, 2011 Report Share Posted March 25, 2011 Я сделал постраничную навигацию, т.к. уход в небытие статей совсем не устраивало... Quote Link to post Share on other sites
Noxter Posted March 26, 2011 Report Share Posted March 26, 2011 martТак может и в поиск сможешь сделать постраничную навигацию? Или расскажи хотя бы как сделал постраничную навигацию. Quote Link to post Share on other sites
atatat Posted January 12, 2014 Report Share Posted January 12, 2014 Завтра выложу статью по этому вопросу к себе в блог... Делал уже для 1 проекта.Дай, пожалуйста, ссылку. Quote Link to post Share on other sites
mart Posted January 12, 2014 Report Share Posted January 12, 2014 Это было под 1.4.* вроде уже давно почти все на второй версии.P.S. да, исправился - думал о другом... Quote Link to post Share on other sites
Kosjak76 Posted January 12, 2014 Report Share Posted January 12, 2014 Скорее, это было под 1,4,3 Quote Link to post Share on other sites
atatat Posted January 12, 2014 Report Share Posted January 12, 2014 Скорее, это было под 1,4,3 Это было под 2.1.* вроде уже давно почти все на второй версии.А есть реализация на 2.2.4? Quote Link to post Share on other sites
mart Posted January 12, 2014 Report Share Posted January 12, 2014 Так в 2.2.4 уже есть // Количество постов на 1 странице $items_per_page = 20; $filter = array(); // Выбираем только видимые посты $filter['visible'] = 1; // Текущая страница в постраничном выводе $current_page = $this->request->get('page', 'integer'); // Если не задана, то равна 1 $current_page = max(1, $current_page); $this->design->assign('current_page_num', $current_page); // Вычисляем количество страниц $posts_count = $this->blog->count_posts($filter); Возможно Вы просто не вывели pagination.tpl в шаблон? Quote Link to post Share on other sites
atatat Posted January 12, 2014 Report Share Posted January 12, 2014 Так в 2.2.4 уже есть // Количество постов на 1 странице $items_per_page = 20; $filter = array(); // Выбираем только видимые посты $filter['visible'] = 1; // Текущая страница в постраничном выводе $current_page = $this->request->get('page', 'integer'); // Если не задана, то равна 1 $current_page = max(1, $current_page); $this->design->assign('current_page_num', $current_page); // Вычисляем количество страниц $posts_count = $this->blog->count_posts($filter); Возможно Вы просто не вывели pagination.tpl в шаблон?У меня так там написано: {if $products|count>2 || $total_pages_num>1} <script type="text/javascript" src="js/ctrlnavigate.js"></script> <div class="pagination"> {if $products|count>2} <div class="sort">Сортировать по: <select onchange="location = this.value;"> <option value="{url sort=position}" {if $sort=='position'} selected{/if}>Умолчанию</option> <option value="{url sort=name}" {if $sort=='name'} selected{/if}>Имени</option> <option value="{url sort=price}" {if $sort=='price'} selected{/if}>Цене</option> </select> </div> {/if} {if $total_pages_num>1} {$visible_pages = 9} {$page_from = 1} {if $current_page_num > floor($visible_pages/2)}{$page_from = max(1, $current_page_num-floor($visible_pages/2)-1)}{/if} {if $current_page_num > $total_pages_num-ceil($visible_pages/2)}{$page_from = max(1, $total_pages_num-$visible_pages-1)}{/if} {$page_to = min($page_from+$visible_pages, $total_pages_num-1)} <a {if $current_page_num==1}class="selected"{/if} href="{url page=null}">1</a> {if $visible_pages < $total_pages_num-1 && $current_page_num > ($visible_pages-1)/2+2}<a class="prev_page_link" href="{url page=$current_page_num-floor($visible_pages/2)}">◄</a>{/if} {section name=pages loop=$page_to start=$page_from} {$p = $smarty.section.pages.index+1} {if ($p == $page_from+1 && $p!=2) || ($p == $page_to && $p != $total_pages_num-1)} {else}<a {if $p==$current_page_num}class="selected"{/if} href="{url page=$p}">{$p}</a>{/if} {/section} {if $visible_pages < $total_pages_num-1 && $total_pages_num - $current_page_num > $visible_pages/2 + 1}<a class="next_page_link" href="{url page=$current_page_num + floor($visible_pages/2)}">►</a>{/if} <a {if $current_page_num==$total_pages_num}class="selected"{/if} href="{url page=$total_pages_num}">{$total_pages_num}</a> <a href="{url page=all}" title='всё из этой категории на одной странице'>всё</a> {/if} </div> {/if} Quote Link to post Share on other sites
atatat Posted January 12, 2014 Report Share Posted January 12, 2014 Понял что число выводимых новостей это 20, а где его изменить никак не найду. Quote Link to post Share on other sites
Kosjak76 Posted January 12, 2014 Report Share Posted January 12, 2014 // Количество постов на 1 странице $items_per_page = 20; Вот тут и поменять. Quote Link to post Share on other sites
atatat Posted January 12, 2014 Report Share Posted January 12, 2014 // Количество постов на 1 странице$items_per_page = 20;Вот тут и поменять.Куда мне вставить в мой код? {if $products|count>2 || $total_pages_num>1} <script type="text/javascript" src="js/ctrlnavigate.js"></script> <div class="pagination"> {if $products|count>2} <div class="sort">Сортировать по: <select onchange="location = this.value;"> <option value="{url sort=position}" {if $sort=='position'} selected{/if}>Умолчанию</option> <option value="{url sort=name}" {if $sort=='name'} selected{/if}>Имени</option> <option value="{url sort=price}" {if $sort=='price'} selected{/if}>Цене</option> </select> </div> {/if} {if $total_pages_num>1} {$visible_pages = 9} {$page_from = 1} {if $current_page_num > floor($visible_pages/2)}{$page_from = max(1, $current_page_num-floor($visible_pages/2)-1)}{/if} {if $current_page_num > $total_pages_num-ceil($visible_pages/2)}{$page_from = max(1, $total_pages_num-$visible_pages-1)}{/if} {$page_to = min($page_from+$visible_pages, $total_pages_num-1)} <a {if $current_page_num==1}class="selected"{/if} href="{url page=null}">1</a> {if $visible_pages < $total_pages_num-1 && $current_page_num > ($visible_pages-1)/2+2}<a class="prev_page_link" href="{url page=$current_page_num-floor($visible_pages/2)}">◄</a>{/if} {section name=pages loop=$page_to start=$page_from} {$p = $smarty.section.pages.index+1} {if ($p == $page_from+1 && $p!=2) || ($p == $page_to && $p != $total_pages_num-1)} {else}<a {if $p==$current_page_num}class="selected"{/if} href="{url page=$p}">{$p}</a>{/if} {/section} {if $visible_pages < $total_pages_num-1 && $total_pages_num - $current_page_num > $visible_pages/2 + 1}<a class="next_page_link" href="{url page=$current_page_num + floor($visible_pages/2)}">►</a>{/if} <a {if $current_page_num==$total_pages_num}class="selected"{/if} href="{url page=$total_pages_num}">{$total_pages_num}</a> <a href="{url page=all}" title='всё из этой категории на одной странице'>всё</a> {/if} </div> {/if} Quote Link to post Share on other sites
Kosjak76 Posted January 12, 2014 Report Share Posted January 12, 2014 Никуда, это код РНР, а не шаблона. Это в файле БлогВью.пхп Quote Link to post Share on other sites
atatat Posted January 12, 2014 Report Share Posted January 12, 2014 Никуда, это код РНР, а не шаблона.Это в файле БлогВью.пхпБольшое спасибо! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.