vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Ideas needed on how this ordering can be achieved (https://vborg.vbsupport.ru/showthread.php?t=76482)

cinq 02-17-2005 08:32 AM

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 :D
Thanks

trafix 02-17-2005 09:25 AM

look at the coding for the jukebox .... it has most of that for playing defult song ;)

cinq 02-17-2005 09:33 AM

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 ?

trafix 02-17-2005 09:44 AM

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
  "
); 


cinq 02-17-2005 09:47 AM

I know the query to get the stuff i need :p

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.

sabret00the 02-17-2005 09:54 AM

seriously i'd just suggest adding a column to the table "block_order" and then [sql]ORDER BY links.block_order[/sql]

cinq 02-17-2005 11:46 AM

Hmm, isn't there another means ?

Dean C 02-17-2005 12:26 PM

I wouldn't use queries for this. Use vBcron and cache the info every x hours :)

cinq 02-17-2005 12:32 PM

You lost me there, Dean :)

sabret00the 02-17-2005 02:42 PM

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.


All times are GMT. The time now is 03:20 AM.

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.04488 seconds
  • Memory Usage 1,735KB
  • 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
  • (1)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete