Редактор темы

Реклама
Реклама

Ajax подгрузка custom в нужный блок

  • Автор темы Автор темы PunPun
  • Дата начала Дата начала
все равно не работает
сделал, как на 2й странице Progressive писал
все такая же ошибка
Fatal error: Uncaught Error: Class 'DLEPlugins' not found in ...../engine/ajax/custom.php:15 Stack trace: #0 {main} thrown in ....../engine/ajax/custom.php on line 15
 
подключил строку include_once ENGINE_DIR . '/classes/plugins.class.php';
выше остальных в custom.php

upd.победил
 
Приветствую. Как замутить чтобы работала отложенная загрузка? Поставил, но при смене не отображаются постеры.

Отбой, сам замутил)
 
Последнее редактирование:
Решил ли кто-нибудь проблему с подключением этого плагина в datalife 15.1 ? Если да, поделитесь плиз. Кучу ошибок выдает.
 
Решил ли кто-нибудь проблему с подключением этого плагина в datalife 15.1 ? Если да, поделитесь плиз. Кучу ошибок выдает.
У меня 15.1 с переделанным мною шаблоном, скачанными откуда из интернета. Там была похожая конструкция и она вроде бы работает без ошибок. Попробую перенести сюда аналогичные фрагменты по примеру кода с первого поста, как они есть у меня.
Код:
<?php
// by сайт lazydev Back-End разработчик и SEO оптимизатор
@error_reporting ( E_ALL ^ E_WARNING ^ E_NOTICE );
@ini_set ( 'display_errors', true );
@ini_set ( 'html_errors', false );
@ini_set ( 'error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE );

define( 'DATALIFEENGINE', true );
define( 'ROOT_DIR', substr( dirname(  __FILE__ ), 0, -12 ) );
define( 'ENGINE_DIR', ROOT_DIR . '/engine' );

include ENGINE_DIR . '/classes/plugins.class.php';
include ENGINE_DIR . '/data/config.php';
require_once ENGINE_DIR . '/classes/mysql.php';
require_once ENGINE_DIR . '/data/dbconfig.php';
require_once ENGINE_DIR . '/modules/functions.php';
require_once ENGINE_DIR . '/classes/templates.class.php';

dle_session();

require_once ENGINE_DIR . '/modules/sitelogin.php';
require_once ROOT_DIR . '/language/' . $config['langs'] . '/website.lng';
@header( "Content-type: text/html; charset=" . $config['charset'] );

if(!$is_logged) $member_id['user_group'] = 5;

//################# Определение групп пользователей
$user_group = get_vars( "usergroup" );
if( ! $user_group ) {
    $user_group = array ();
    $db->query( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
    while ( $row = $db->get_row() ) {
        $user_group[$row['id']] = array ();
        foreach ( $row as $key => $value ) $user_group[$row['id']][$key] = stripslashes($value);
    }
    set_vars( "usergroup", $user_group );
    $db->free();
}
//################# Определение категорий и их параметры
$cat_info = get_vars( "category" );
if( ! is_array( $cat_info ) ) {
    $cat_info = array ();
    $db->query( "SELECT * FROM " . PREFIX . "_category ORDER BY posi ASC" );
    while ( $row = $db->get_row() ) {
        $cat_info[$row['id']] = array ();
        foreach ( $row as $key => $value ) $cat_info[$row['id']][$key] = stripslashes( $value );
    }
    set_vars( "category", $cat_info );
    $db->free();
}
define( 'TEMPLATE_DIR', ROOT_DIR . '/templates/'.$config['skin']);
$custom = isset($_POST["castom"]) && is_scalar($_POST["castom"]) ? trim(strip_tags(stripslashes($_POST["castom"]))) : false;
if($custom==false) return;
if( strpos( $custom, "custom" ) !== false ) {
    $custom = "{".$custom."}";
    $custom = preg_replace_callback( "#\\{custom(.+?)\\}#i", "custom_print", $custom );
    if($custom !="") echo $custom;
}
?>
Отличается лишь строкой:
Код:
include ENGINE_DIR . '/classes/plugins.class.php';
В табах на переключателях:
Код:
<div class="side-bc">
    <div class="popular tb-wrp">
        <div class="st-tabs">
            <span class="current" data-ajaxc="custom category='4' template='modules/popular' subcat='yes' from='0' limit='9' cache='yes'">Фильмы</span>
            <span data-ajaxc="custom category='1' template='modules/popular' subcat='yes' from='0' limit='9' cache='yes'">Сериалы</span>
            <span data-ajaxc="custom category='7' template='modules/popular' subcat='yes' from='0' limit='9' cache='yes'">Тв-шоу</span>
        </div>
        <div class="p_in tb-cont fx-row">
            {custom days="90" template="modules/popular" order="rating" category='5,6' subcat="yes" from='0' limit="9" cache="yes"}
        </div>
    </div>
</div>
В lib.js:
Код:
$("body").on("click", "[data-ajaxc]:not(.current)", function(){
    var $castom = $(this).attr("data-ajaxc"),
        $targetBox = $(this).closest('.tb-wrp').children('.tb-cont');
    $targetBox.html(ShowLoading(''));
    $.post(dle_root+"engine/ajax/custom.php", {castom:$castom}, function(data){
        $mobilecarousel.data('owl.carousel').destroy();
        $targetBox.html(data);
        /*$('.th-rate').wRateTen();*/
        $('.short-rate-perc').wRatePercent();
        $mobilecarousel.owlCarousel({
            items:8,
            loop:true,
            rewind:true,
            nav:true,
            navText:['<span class="fal fa-angle-left fa-2x"></span>','<span class="fal fa-angle-right fa-2x"></span>'],
            slideBy:1,
            dots:false,
            autoplay:false,
            autoplayTimeout:12000,
            autoWidth:true,
            margin:12
        });
    });
    $targetBox.html( HideLoading('') );
    $(this).addClass('current').siblings().removeClass('current');
});
data-trigercajax вроде как не используется.
 
Основная проблема в моей версии скрывалась в том, что сайт работал на php8.1. Как только перешел на 7.4, решилось сразу несколько проблем в разных модулях, и в этом. Всё работает как задумывалось.
 
Автор темы
Не рекомендую использовать этот вариант подргрузки, он хреновый.
 
Какие проверки? Что вырезать?
@error_reporting ( E_ALL ^ E_WARNING ^ E_NOTICE );
@ini_set ( 'display_errors', true );
@ini_set ( 'html_errors', false );
@ini_set ( 'error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE );

define( 'DATALIFEENGINE', true );
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'ENGINE_DIR', ROOT_DIR . '/engine' );

include ENGINE_DIR . '/classes/plugins.class.php';
include ENGINE_DIR . '/data/config.php';
require_once ENGINE_DIR . '/classes/mysql.php';
require_once ENGINE_DIR . '/data/dbconfig.php';
require_once ENGINE_DIR . '/modules/functions.php';
require_once ENGINE_DIR . '/classes/templates.class.php';

dle_session();

require_once ENGINE_DIR . '/modules/sitelogin.php';
require_once ROOT_DIR . '/language/' . $config['langs'] . '/website.lng';
@header( "Content-type: text/html; charset=" . $config['charset'] );

if(!$is_logged) $member_id['user_group'] = 5;
 
Автор темы
@error_reporting ( E_ALL ^ E_WARNING ^ E_NOTICE );
@ini_set ( 'display_errors', true );
@ini_set ( 'html_errors', false );
@ini_set ( 'error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE );

define( 'DATALIFEENGINE', true );
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'ENGINE_DIR', ROOT_DIR . '/engine' );

include ENGINE_DIR . '/classes/plugins.class.php';
include ENGINE_DIR . '/data/config.php';
require_once ENGINE_DIR . '/classes/mysql.php';
require_once ENGINE_DIR . '/data/dbconfig.php';
require_once ENGINE_DIR . '/modules/functions.php';
require_once ENGINE_DIR . '/classes/templates.class.php';

dle_session();

require_once ENGINE_DIR . '/modules/sitelogin.php';
require_once ROOT_DIR . '/language/' . $config['langs'] . '/website.lng';
@header( "Content-type: text/html; charset=" . $config['charset'] );

if(!$is_logged) $member_id['user_group'] = 5;
А этот тут причем?
 
Автор темы
Прости, я тебя не понимаю и ты пишешь какую-то чушь. Ты хоть знаешь что это за код, что ты скинул? И зачем его вырезать?
Обьясни что это за код, я не знаю.
 

Похожие темы Последние темы Популярные темы

Назад
Сверху