Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-28-2008, 08:43 AM
wolfe wolfe is offline
 
Join Date: Jan 2002
Posts: 900
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Vb option array

i have a vb option with a list of forum ids seperated by commas but when i use it in the php file $vbulletin->options[fids] in a query i get thread.forumid = (Array) error

how do i get around this.

thx in advance
Reply With Quote
  #2  
Old 01-28-2008, 08:50 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please post the code you are using.
Reply With Quote
  #3  
Old 01-28-2008, 09:22 AM
wolfe wolfe is offline
 
Join Date: Jan 2002
Posts: 900
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

k

PHP Code:
    // Count all log entries
    
$tcount $vbulletin->db->query_first("
        SELECT COUNT(*) AS `tcount`
        FROM " 
TABLE_PREFIX "thread AS thread
        WHERE thread.forumid IN(
$vbulletin->options[fids])
    "
);
    
$vbulletin->db->free_result($fcount); 
Reply With Quote
  #4  
Old 01-28-2008, 09:34 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
    // Count all log entries
    
$tcount $vbulletin->db->query_first("
        SELECT COUNT(*) AS `tcount`
        FROM " 
TABLE_PREFIX "thread AS thread
        WHERE thread.forumid IN(" 
$vbulletin->options['fids'] . ")
    "
);
    
$vbulletin->db->free_result($fcount); 
Reply With Quote
  #5  
Old 01-28-2008, 09:50 AM
wolfe wolfe is offline
 
Join Date: Jan 2002
Posts: 900
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thx m8 worked a treat what about this one this giving errors

PHP Code:
$forumchoic implode(','fetch_search_forumids($vbulletin->options['fids'] ,'')); 
Reply With Quote
  #6  
Old 01-28-2008, 10:20 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If that option contains a list of comma-seperated values, then you are probably looking for explode() to convert it to an array. Also the 3rd parameter is not needed.
Reply With Quote
  #7  
Old 01-28-2008, 10:24 AM
wolfe wolfe is offline
 
Join Date: Jan 2002
Posts: 900
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$forumchoic explode(','fetch_search_forumids("".$vbulletin->options['fids'] . "")); 
not working m8 getting error

Fatal error: Cannot pass parameter 1 by reference in /home/freec/public_html/findex.php on line 100
Reply With Quote
  #8  
Old 01-28-2008, 02:48 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why have you all of a sudden decided to put down quotes around your $vbulletin->options variable?
Reply With Quote
  #9  
Old 01-29-2008, 09:11 AM
wolfe wolfe is offline
 
Join Date: Jan 2002
Posts: 900
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

because i get an (Array) error otherwise
Reply With Quote
  #10  
Old 01-29-2008, 04:51 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You must pass the forum id's as an array to the fetch_search_forumids() function. Make sure you read the code behind the function when you start using them, it will easily prevent you from getting these errors and also make understanding vBulletin a lot better.

If the fetch_search_forumids() is a string you need to first explode() the string into an array then pass this array to the function

N.B. You won't be able to do it inline as you must the variable by reference:
PHP Code:
$vbulletin->options['fids'] = explode(','$vbulletin->options['fids']);
$outcome fetch_search_forumids($vbulletin->options['fids']);
// implode the forum ids or whatever you want 
Again I can't stress enough that you learn a heck of a lot about how a function works by just looking at the PHP code behind it.
Reply With Quote
Reply


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 03:34 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.06830 seconds
  • Memory Usage 2,253KB
  • Queries Executed 13 (?)
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
  • (5)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete