V
V
Valera Udav2013-12-14 03:38:49
PHP
Valera Udav, 2013-12-14 03:38:49

How to implement infinite scrolling for Bitrix infoblocks?

The site implements the usual output of news, but instead of standard pagination, a solution is required in the form of endless scrolling and automatic loading of news. Google gave very little and in fact from the solutions I found only this article odenisova.ru/a/682 and another paid component. I'm working with Bitrix for the first time and I'm already fucking crazy about this combine... Help me implement this function, or chew me the method from the article above, because I didn’t succeed .. Thank you!

Answer the question

In order to leave comments, you need to log in

4 answer(s)
O
Oleg Maksimenko, 2013-12-20
@TARAKANhoy

Described in his blog a simple way to implement

D
Dmitry, 2013-12-14
@webmix

Google any free script of infinite scrolling, and fasten any cms to the right place - this is half an hour of work for a non-coder-coder.

A
Alexey, 2013-12-14
@ScorpLeX

We need a small js script, as in the article, which will make an ajax request to the page when the user has scrolled to the end. The page will return json or html with a new piece of news or whatever needs to be inserted next. Pretty simple like.
PS every time the mention of Bitrix causes a small shiver in the body.

M
Mikhail Livach, 2013-12-14
@Mausglov

I can’t tell you about the js part (somehow track the scrolling, make an ajax request at the right time; I don’t think it’s difficult). Expect the backend response in html format
I propose to do the backend for Ajax in a separate file:

<?
// это строчки - обычный набор для отдельной аяксовой страницы;
// тут исключен вывод шаблона сайта (хедера и футера), только рабочая область
define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);

require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");?>
// сюда закидывается вызов компонента списка новостей с исходной страницы
<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php");
?>

It is worth checking that the site template for the ajax page is the same as for the original one.
The page itself is made through the GET parameter PAGEN_?, the number at the end depends on how many components with the page are on this page. That is, if you send a post-request, you will need to push the page parameter into $_GET before prolog_before

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question