vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Sorting an array of threads (https://vborg.vbsupport.ru/showthread.php?t=200815)

mcahill 01-05-2009 10:35 PM

Sorting an array of threads
 
I need to merge two separate arrays of threads to replace the normal stuff on forumhome.

I have an array, $threadbits and an array $global_threadbits, and I need to merge them and display by last posttime descending.

PHP Code:


$threadbit 
$threadbit $global_threadbit

I need an array_multisort that will use the lastposttime key descending. Anyone have any ideas? I've been pounding on this for hours.

Thanks,

Mark

Dismounted 01-06-2009 02:35 AM

Could you post the array's structure?
PHP Code:

print_r($threadbit); 


mcahill 01-06-2009 12:53 PM

That would be the problem. Attempts to show the vbulletin threadbit array as used in the showforums page doesn't give us the dimensions of the array, only a formatted output.

PHP Code:

<tr
    <
td class="alt1" id="td_threadstatusicon_377785"
        
        <
img src="http://images.splitcoaststampers.com/forums/images/scs2/statusicon/thread.gif" id="thread_statusicon_377785" alt="" border="" /> 
    </
td
    
        <
td class="alt2"><img src="images/icons/icon12.gif" alt="Wink" border="0" /></td
    
 
    <
td class="alt1" id="td_threadtitle_377785" title="Hi All!  I'm new and have a question - I'm looking for 2009 calendars approximate size 2&quot;x2&quot; or 2&quot;x3&quot; up to 3&quot;x3&quot; or 3&quot;x4&quot;.  Does anyone have info as to where I can get these?"
 
        
        <
div
            
                <
span style="float:right"
                    
                    
                    
                     <
a href="#" onclick="attachments(377785); return false"> <img class="inlineimg" src="http://images.splitcoaststampers.com/forums/images/scs2/misc/paperclip.gif" border="0" alt="1 Attachment(s)" /></a
                    
                    
                </
span
            
            
            
            
            
            <
a href="showthread.php?t=377785" id="thread_title_377785">2009 Calendars</a
            
        </
div
    
        
            
        <
div class="smallfont"
            
            
                <
span style="cursor:pointer" onclick="window.open('member.php?u=191203', '_self')">CraftyGrandma</span
            
        </
div
        
        
        
    </
td
    
    
    <
td class="alt2" title="Replies: 1, Views: 16"
        <
div class="smallfont" style="text-align:right; white-space:nowrap"
            
08-28-2008 <br /> 
            
by <a href="member.php?find=lastposter&amp;t=377785" rel="nofollow">Crafty Secrets</a>  <a href="showthread.php?p=11113776#post11113776"><img class="inlineimg" src="http://images.splitcoaststampers.com/forums/images/scs2/buttons/lastpost.gif" alt="Go to last post" border="0" /></a
        </
div
    </
td
    
    
    
        <
td class="alt1" align="center"><a href="#" onclick="who(377785); return false;">1</a></td
        <
td class="alt2" align="center">16</td
            
        
    
    
    
</
tr

--------------- Added [DATE]1231288767[/DATE] at [TIME]1231288767[/TIME] ---------------

So I have spent the better part of the day on this with no results. I have found no way to get the dimensions of the array, since vbulletin is not allowing me to do array_keys either in the product I am developing with or via the page source code. I can do print_r and that's it.

So I need to either know what the keys are named in the threadbit array on forumdisplay.php, or I need to find a way to output the keys.

ANy help appreciated...

Dismounted 01-07-2009 04:20 AM

Run this in your plugin.
PHP Code:

echo '<pre>';
print_r($threadbit);
echo 
'</pre>';
exit; 


mcahill 01-07-2009 03:01 PM

Same results. I'm beginning to think they don't want me messing with the order of threads...

Dismounted 01-08-2009 02:17 AM

I was asking for the result of print_r(). :)


All times are GMT. The time now is 02:55 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01419 seconds
  • Memory Usage 1,747KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete