Thread: Add-On Releases - Module CMPS: AJAX Tabbed Content
View Single Post
  #95  
Old 06-17-2008, 07:05 PM
bartek24m bartek24m is offline
 
Join Date: Nov 2005
Posts: 174
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hello i have a question
how can i change the ordering show list of threads

i would like to see the last 10 threads insted of the last 10 replay....


Coud you explain me how to turn Default Sort Field by Thread start Time ?

PHP Code:

if ($_GET['content'] == 2) {   

echo
'<table cellspacing="2" cellpadding="0" width=100%><tr> <td class="thead" width="50%">Tytuł - Data - Odpowiedzi</td></tr>';

$recthread_tempname 'exp';

        if (
$recthread_tempname == 'exp')
        {
                eval(
'$home[$mods[\'modid\']][\'content\'] = "' fetch_template('adv_portal_recthreads_exp_head') . '";');

                
$mods['colspan'] = 4;

                if (
$mod_options['portal_threads_lastpost'])
                {
                        
$mods['colspan']++;
                }

                if (
$mod_options['portal_threads_showforum'])
                {
                        
$mods['colspan']++;
                }
        }

        
$vba_threads_condition '';

        
// Threads & forums
        
if (!empty($mod_options['portal_threadids']) AND is_array($mod_options['portal_threadids']))
        {
                
$vba_threads_condition 'AND (thread.threadid IN(' 16 ')';
        }
        if (!empty(
$mod_options['portal_threads_forumids']) AND is_array($mod_options['portal_threads_forumids']))
        {
                
$mods['inforums'] = $mod_options['portal_threads_forumids'];

                if (
$mod_options['portal_applypermissions'])
                {
                        
$mods['inforums'] = array_diff($mods['inforums'], $adv_canviewforums);
                }
                if (empty(
$mods['inforums']))
                {
                        if (empty(
$mod_options['portal_threadids']))
                        {
                                
$mods['nodisplay'] = true;
                        }
                }
                else
                {
                        
$vba_threads_condition .= iif(!empty($mod_options['portal_threadids']), ' OR thread'' AND (thread') . '.forumid IN(' 16 ')';
                }
        }

        
// Add ) if we had forum or thread ids
        
if ($vba_threads_condition)
        {
                
$vba_threads_condition .= 'AND (thread.threadid IN(' 16 ')';
        }

        if (!
$mods['inforums'] AND !empty($adv_canviewforums) AND $mod_options['portal_applypermissions'])
        {
                
$vba_threads_condition .= ' AND thread.forumid NOT IN(' implode(','$adv_canviewforums) . ')';
        }

        
$show['lastpost'] = $mod_options['portal_threads_lastpost'];

        if (!
$mods['nodisplay'])
        {
                if (
$mod_options['portal_threads_orderby'] == 'dateline')
                {
                        
$mod_options['portal_threads_orderby'] = 'thread.dateline';
                }

                if (!
$mod_options['portal_threads_orderby'])
                {
                        
$mod_options['portal_threads_orderby'] = 'lastpost';
                }
                if (!
$mod_options['portal_threads_direction'])
                {
                        
$mod_options['portal_threads_direction'] = 'DESC';
                }

                
$markinglimit = (TIMENOW - ($vbulletin->options['markinglimit'] * 86400));

                
// Rating
                
$oldforumratings $foruminfo['allowratings'];
                
$foruminfo['allowratings'] = $mod_options['portal_threads_showrating'];

                
$rtrating_fields '';
                if (
$mod_options['portal_threads_showrating'] OR $mod_options['portal_threads_orderby'] == 'voteavg')
                {
                        
$rtrating_fields 'IF(votenum >= ' $vbulletin->options['showvotes'] . ', votenum, 0) AS votenum, IF(votenum >= ' $vbulletin->options['showvotes'] . ' AND votenum != 0, votetotal / votenum, 0) AS voteavg, votetotal,';
                }

                
$rthread_fields '';
                
$rthread_join '';

                
// Subscriptions
                
if ($mod_options['portal_threads_showsubscribed'] AND $vbulletin->userinfo['userid'])
                {
                        
$rthread_fields .= ', NOT ISNULL(subscribethread.subscribethreadid) AS subscribed';
                        
$rthread_join .= ' LEFT JOIN ' TABLE_PREFIX 'subscribethread AS subscribethread ON (subscribethread.threadid = thread.threadid AND subscribethread.userid = ' $vbulletin->userinfo['userid'] . ')';
                }

                
// Thread Icon
                
if ($mod_options['portal_threads_showicon'])
                {
                        
$rthread_fields .= ', thread.iconid AS threadiconid, iconpath AS threadiconpath';
                        
$rthread_join .= ' LEFT JOIN ' TABLE_PREFIX 'icon AS icon ON (icon.iconid = thread.iconid)';
                }

                
// Preview
                
if ($mod_options['portal_threads_showpreview'] AND $vbulletin->options['threadpreview'])
                {
                        
$rthread_fields .= ', post.pagetext AS preview';
                        
$rthread_join .= ' LEFT JOIN ' TABLE_PREFIX 'post AS post ON (post.postid = thread.firstpostid)';
                }

                
// Database read marking
                
if ($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'])
                {
                        
$rthread_fields .= ', threadread.readtime AS threadread';
                        
$rthread_join .= ' LEFT JOIN ' TABLE_PREFIX 'threadread AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = ' $vbulletin->userinfo['userid'] . ')
                                LEFT JOIN ' 
TABLE_PREFIX 'forumread AS forumread ON (thread.forumid = forumread.forumid AND forumread.userid = ' $vbulletin->userinfo['userid'] . ')';
                }

                
// Attach paperclip
                
if ($mod_options['portal_threads_showpaperclip'])
                {
                        
$rthread_fields .= ', thread.attach';
                }

                
// COMMENTED OUT FOR TESTING
                
($hook vBulletinHook::fetch_hook('vba_cmps_module_recthreads_start')) ? eval($hook) : false;

                
$threads $db->query_read("
                    SELECT 
$rtrating_fields thread.threadid, thread.title, thread.replycount, postusername, postuserid, thread.dateline AS postdateline, IF(views <= thread.replycount, thread.replycount+1, views) AS views, thread.lastposter, thread.lastpost, thread.lastpostid, pollid, thread.forumid, thread.open, sticky
                    
$rthread_fields
                        FROM " 
TABLE_PREFIX "thread as thread
                        
$rthread_join
                        WHERE open != 10
                                AND thread.visible = 1 " 
.
                                
iif($mod_options['portal_threads_cutoffdate'],
                                        
'AND thread.lastpost > ' . (TIMENOW $mod_options['portal_threads_cutoffdate'] * 86400)
                                ) .
                                
iif($ignusers,
                                        
' AND thread.postuserid NOT IN(' $ignusers ')'
                                
) . "
                                AND thread.forumid=198 OR thread.forumid=197
                        ORDER BY 
$mod_options[portal_threads_orderby] $mod_options[portal_threads_direction]
                        LIMIT 10
                "
);
                
$mods['threadcount'] = $db->num_rows($threads);

                if (
$mods['threadcount'])
                {
                        require_once(
DIR '/includes/functions_forumdisplay.php');

                        if (
$mod_options['portal_threads_multipage'])
                        {
                                
$vbulletin->templatecache['threadbit_pagelink'] = str_replace(
                                        
'"$address"',
                                        
'"' $vbulletin->options['bburl'] . '/$address"',
                                        
$vbulletin->templatecache['threadbit_pagelink']
                                );
                        }

                        
// Table cell classes
                        
$bgclass 'alt1';

                        if (
$show['lastpost'])
                        {
                                
// Don't need a variable since it's after a known class, just switch
                                
exec_switch_bg();
                        }

                        if (
$mod_options['portal_threads_replies'])
                        {
                                
$class_reply exec_switch_bg();
                        }

                        if (
$mod_options['portal_threads_views'])
                        {
                                
$class_view exec_switch_bg();
                        }

                        if (
$mod_options['portal_threads_showforum'])
                        {
                                
$class_ftitle exec_switch_bg();
                        }

                        
$recthreads_comma '';
                        if (
$mod_options['portal_threads_views'] AND $mod_options['portal_threads_replies'])
                        {
                                
$recthreads_comma ', ';
                        }
                }

                while (
$thread $db->fetch_array($threads))
                {
                        
$bgclass exec_switch_bg();

                        if (!(
$adv_forumperms[$thread['forumid']] & $vbulletin->bf_ugp_forumpermissions['canviewthreads']))
                        {
                                
$thread['preview'] = '';
                        }
                        else
                        {
                                
// The vB preview function can be intensive w/ long strings, so let's try to save some overhead
                                
$thread['preview'] = substr($thread['preview'], 0, ($vbulletin->options['threadpreview'] * 10));
                        }

                        
// Trim title
                        
if (strlen($thread['title']) > $mod_options['portal_threads_maxchars'] AND $mod_options['portal_threads_maxchars'])
                        {
                                
$thread['title'] = fetch_trimmed_title($thread['title'], $mod_options['portal_threads_maxchars']);
                        }

                        
// Check for long words that may stretch the page
                        
if ($mod_options['portal_threads_maxwordchars'])
                        {
                                
$thread['titlecheck'] = explode(' '$thread['title']);

                                if (!empty(
$thread['titlecheck']))
                                {
                                        
$thread['title'] = '';

                                        foreach (
$thread['titlecheck'] AS $key => $word)
                                        {
                                                if (!
$thread['titletrimmed'])
                                                {
                                                        if (
strlen($word) > $mod_options['portal_threads_maxwordchars'])
                                                        {
                                                                
$word fetch_trimmed_title($word$mod_options['portal_threads_maxwordchars']);
                                                                
$thread['titletrimmed'] = true;
                                                        }

                                                        if (
$thread['title'])
                                                        {
                                                                
$thread['title'] .= ' ';
                                                        }

                                                        
$thread['title'] .= $word;
                                                }
                                        }
                                }
                        }

                        
// Thread read marking
                        
if ($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'])
                        {
                                if (
$thread['threadread'] < $thread['forumread'])
                                {
                                        
$thread['threadread'] = $thread['forumread'];
                                }
                        }
                        else if (!
$vb_read_cookies[$thread['forumid']])
                        {
                                
$vb_read_cookies[$thread['forumid']] = max(fetch_bbarray_cookie('forum_view'$thread['forumid']), $markinglimit);
                        }

                        if (!
$thread['threadread'] AND $vb_read_cookies[$thread['forumid']] > $thread['lastpost'])
                        {
                                
$thread['threadread'] = TIMENOW;
                        }
                        else
                        {
                                
$thread['threadread'] = '-1';
                        }

                        
$thread process_thread_array(
                                
$thread,
                                
$thread['threadread'],
                                
$mod_options['portal_threads_showicon']
                        );

                        
// Rating
                        
$thread['rating'] = intval(round($thread['voteavg']));

                        (
$hook vBulletinHook::fetch_hook('vba_cmps_module_recthreadsbits')) ? eval($hook) : false;

                        eval(
'$home["$mods[modid]"][\'content\'] .= "' fetch_template('adv_portal_recthreads_exp') . '";');

                        
// define('BR', '<'.'BR'.'>');
                        // echo "{$thread['title']}".BR;
                        // echo "by: {$thread['postusername']}".BR;
                        // echo "{$thread[postdate]}" . " " . "{$thread[posttime]}".BR;
                        // echo BR;

                        
echo '<tr> <td class="alt1" class="smallfont">&raquo;&nbsp;<a href="http://www.clubbers.pl/showthread.php?t=' $thread[threadid] . '"title="' $thread[preview] . '">' $thread[title] . '</a> <span class="smallfont">&nbsp;&nbsp;&nbsp;' $thread[postdate] . '&nbsp;' $thread[posttime] . '&nbsp;-&nbsp;' $thread[replycount] . '&nbsp;Komentarzy</span></td></tr>';



                 }
        }

$tabstring $thread;


        
$db->free_result($threads);
        unset(
$thread);

        
$foruminfo['allowratings'] = $oldforumratings;

        if (!
$mods['threadcount'] OR $mods['nodisplay'])
        {
                
$show['tablerow'] = true;
                if (
$mods['modcol'] == 1)
                {
                        
$home["$mods[modid]"]['content'] = construct_phrase($vbphrase['no_x_to_display'], $vbphrase['threads']);
                }
                else
                {
                        
$home["$mods[modid]"]['content'] = construct_phrase($vbphrase['no_x_to_display'], $vbphrase['threads']);
                }
        }

//}

echo "</table>";



}   


if (
$_GET['content'] == 3) {   

echo 
'<table cellspacing="2" cellpadding="0" width=100%><tr> <td class="alt2"><span class="smallfont">Welcome Back To YOURSITENAMEHERE&nbsp;<b>' $vbulletin->userinfo['username'] . '!</b><br><br>Hope you are enjoying the off season so far.<br><br> The Draft, Mini Camps & Hall of Fame Weekend Events are complete, Train Camps are in full swing and Preseason Games have started to kick off!<br><br>
Im sure these next few weeks will be fun to follow and make the upcoming season even more exciting. <br><br>Good luck with your team&nbsp;<b>' 
.  $vbulletin->userinfo['username'] . '.</b></span></td></tr>';


Thank you for help
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01484 seconds
  • Memory Usage 2,067KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete