Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 02-17-2005, 08:32 AM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Ideas needed on how this ordering can be achieved

Would like to showcase the following on the main links page.

Latest links
Most popular links
Random link

Each of these would be a block on the main page.
They would probably require 3 different queries.

My question is how can I achieve this :

I can set in the Admincp option : display orders for each block, such that I can arrange which block appears first, second and third.

Any ideas would be most appreciated
Thanks
Reply With Quote
  #2  
Old 02-17-2005, 09:25 AM
trafix's Avatar
trafix trafix is offline
 
Join Date: Dec 2002
Location: Australia
Posts: 1,021
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

look at the coding for the jukebox .... it has most of that for playing defult song
Reply With Quote
  #3  
Old 02-17-2005, 09:33 AM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did a quick scan, I presume you mean the part below

Code:
//start load the song
of the vb_jukebox.php file ?

Don't really think it does what I seek ?
Reply With Quote
  #4  
Old 02-17-2005, 09:44 AM
trafix's Avatar
trafix trafix is offline
 
Join Date: Dec 2002
Location: Australia
Posts: 1,021
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Most popular links
this finds the most played song
PHP Code:
  $mostplayed $DB_site->query_first("
   SELECT * 
   FROM " 
TABLE_PREFIX "vb_jukebox_trax 
   WHERE active = 1
     ORDER BY plays 
   DESC LIMIT 1
  "
); 
Random link
PHP Code:
  $getimage $DB_site->query_first("
   SELECT * 
   FROM " 
TABLE_PREFIX "vb_jukebox_trax
   WHERE active = 1
   ORDER BY RAND() DESC LIMIT 1
  "
); 
Reply With Quote
  #5  
Old 02-17-2005, 09:47 AM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I know the query to get the stuff i need

What i mean is how could I order the blocks that shows these stuff ( latest, random, most popular ) based on changeable settings for display orders in the Admincp.

edit: p.s I think order by rand() desc makes no sense just order by rand() will do.
Reply With Quote
  #6  
Old 02-17-2005, 09:54 AM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

seriously i'd just suggest adding a column to the table "block_order" and then [sql]ORDER BY links.block_order[/sql]
Reply With Quote
  #7  
Old 02-17-2005, 11:46 AM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm, isn't there another means ?
Reply With Quote
  #8  
Old 02-17-2005, 12:26 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I wouldn't use queries for this. Use vBcron and cache the info every x hours
Reply With Quote
  #9  
Old 02-17-2005, 12:32 PM
cinq's Avatar
cinq cinq is offline
 
Join Date: Oct 2002
Posts: 1,398
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You lost me there, Dean
Reply With Quote
  #10  
Old 02-17-2005, 02:42 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the only other way i can think of cinq is to do something like set it up in the vboptions so you can have the blocks orders then in your code set em out as an array, then cycle through the array with a while, using the block id's to set the order

i.e.
vboptions[blockorder1]
vboptions[blockorder2]
vboptions[blockorder3]

ok this may be impossible without a query but use a function to arrange them in numerical order as an array

numorder[array] //would look something like = "3, 1, 2"
ofcourse for that you'd need to assume your instructions dictate that which block is which number in the array

anyway from there

PHP Code:
        while($order $numorder[array])
        {
            
$block .= "$order[blockid]";
        } 
i can't explain it but chances are if i wanted to do what you're trying that'd be what i'd try.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:15 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05514 seconds
  • Memory Usage 2,256KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete