Jump to content

Recommended Posts

1501855904_071329r22bdqnwj9baqjg8.png

 

[Модуль] AJAX Альбомы может кому пригодится от + не откажусь)))

 

1.Зайдите в albums.php и после switch($act){ вставте

//################### Показ всех АЛЬБОМОВ юзера(BOX) ###################//
 case "all_albums_user":
 $uid = intval($_POST['uid']);
 $user_id = intval($_POST['user_id']);
 $rows = intval($_POST['user_albums_num']);
 
 $rows = $db->super_query("SELECT user_albums_num FROM `".PREFIX."_users` WHERE user_id = '{$user_id}'"); 
 $row_owner = $db->super_query("SELECT user_search_pref, user_id, user_albums_num, user_new_mark_photos FROM `".PREFIX."_users` WHERE user_id = '{$user_id}'");
 $author_info = explode(' ', $row_owner['user_search_pref']);
 
 if($_POST['page'] > 0) $page = intval($_POST['page']); else $page = 1;
 $gcount = 1;
 $limit_page = ($page-1)*$gcount;
 
 $sql_ = $db->super_query("SELECT aid, name, adate, photo_num, descr, comm_num, cover, ahash, privacy FROM `".PREFIX."_albums` WHERE user_id = '{$user_id}' ORDER by `position` ASC", 1);
 if($sql_){
 $tpl->load_template('profile_subscription_box_top_albums.tpl');
 $tpl->set('[top]', '');
 $tpl->set('[/top]', '');
 $tpl->set('{user_id}', $row_owner['user_id']);
 $tpl->set('{subcr-num}', '<span id="traf">'.$rows['user_albums_num'].' '.gram_record($rows['user_albums_num'], 'albums'));
 $tpl->set('{last_name}', gramatikName($author_info[0]));
 
 $tpl->set_block("'\\[bottom\\](.*?)\\[/bottom\\]'si","");
 $tpl->compile('content');
 
 $tpl->load_template('profile_albums_ajax.tpl');
 foreach($sql_ as $row_albums){
 if($row_albums['cover'])
 $tpl->set('{cover}', "/upload/users/{$user_id}/albums/{$row_albums['aid']}/c_{$row_albums['cover']}");
 else
 $tpl->set('{cover}', '{templates}/images/no_cover.png');
 $tpl->set('{name}', stripslashes($row_albums['name']));
 $tpl->set('{id}', $row_albums['aid']);
 $tpl->set('{date}', $row_albums['adate']);
 $tpl->set('{num}', '<span id="traf">'.$row_albums['photo_num'].' '.gram_record($row_albums['photo_num'], 'photos'));
 $tpl->compile('content');
 }
 
 box_navigation($gcount, $subscr_num, $user_id, 'Albums.all_albums_user', $subscr_num);
 
 }
 
 AjaxTpl();
 
 die();
 break;
2.Откройте файл profile.js и после var Albums = { вставте
 all_albums_user: function(user_id, page_num){
 if(page_num)
 page = '&page='+page_num;
 else {
 page = '';
 page_num = 1;
 }
 
 var num = $('#albums_num').text();
 
 Box.Page('/?go=albums&act=all_albums_user', 'user_id='+user_id+'&num='+num+page, 'all_albums_users_'+user_id+page_num, 625, lang_132albums, lang_msg_close, 0, 0, 345, 1, 1, 1, 0, 1);
 },
3.Загрузите profile_subscription_box_top_albums.tpl и profile_albums_ajax.tpl в ваш шаблон
4.Кнопка вызова вставте в шаблоне сайта в удобное для вас место
<a onclick="Albums.all_albums_user('{user-id}')">Альбомы</a>

Не забудьте добавить в /templates/Default/js/Russian/lang.js
lang_132albums = 'Альбомы';


 

 

 

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×