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 07-01-2006, 07:41 PM
aggiefan aggiefan is offline
 
Join Date: Apr 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Help With Dropdown in Template/PHP

I'm working on a 3.5 modification (first time ever) of a sports "pick 'em" contest that is similar to vBPool. I had created it for 3.0, but the upgrade to 3.5 killed it. Football season is coming up and I'm trying hard to get it up and running again for this year. My problem is as follows:

I need the dropdown box (setup in the template) to go read a table in my database called vBContests and display all the results it finds (loop until fails). vBContests is one column (column name is contestname). I then just want them to select the result that they want. It doesn't have to do anything when they select it other than display it in the box.

My question, and I'm no coder, so forgive me if it's dumb...but can somebody help me with the javascript text in the template and the related php code for the php file (the query)?

I've tried to look at other hacks and can't find anything similar. The quick style chooser may be doing what I want -- but I haven't been able to figure out how that works. If anybody can help, I'd be greatly appreciative.

UPDATE

Okay, I've got it semi-working...but it's just displaying the first table and not looping to all of them. I know my code is wrong -- since it's bits and pieces from different places...so, can somebody offer advice?

My PHP code:
Code:
$activecontestquery = $db->query_read("
	SELECT *
	FROM vBContests
	
");

if (!$db->num_rows($activecontestquery))
{
$contesterr = '<div align="center"><em>There are no contests!</em></div>';
}
else
{while ($contest = $db->fetch_array($activecontestquery))
{
$user = $contest['contestname'];
if I print $contest, it displays all the contest names on the top of my php page, so I'm sure the query is right.

For the template, I have this (and I think this is what needs to be changed:
Code:
<tr><td class="alt2" align="center" colspan="8">Select an active contest<script type="text/javascript">
<!--
function go1(){
if (document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value != "none") {
location = document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value
		}
	}
//-->
</script>
<script type="text/javascript">
<!--
document.write('<form name="selecter1"><select name="select1" size=1>');
document.write('<option value=none>--------------------');
document.write('<option value="$activecontestquery">$user');
// end hiding contents -->
</script>

	</td></tr>

Again, I know the code is probably not efficient and way wrong, but it's semi-working. I'm learning as I go, but could sure use some help now. Thanks!
Reply With Quote
  #2  
Old 07-04-2006, 03:43 AM
aggiefan aggiefan is offline
 
Join Date: Apr 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So I'm guessing this is basically impossible (or to hard to do)? Any ideas out there on a possible workaround?
Reply With Quote
  #3  
Old 07-04-2006, 11:25 AM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i need the rest of your code for your loop in order to help you. although basically i'm assuming the list constructor needs to be prefixed with a period

PHP Code:
$list .= "<li>" $content .  "</li>"
Reply With Quote
  #4  
Old 07-25-2006, 02:41 PM
jibious's Avatar
jibious jibious is offline
 
Join Date: Nov 2002
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

if you get this working, will you be releasing it? please let me know. thanks.
Reply With Quote
  #5  
Old 07-27-2006, 04:27 PM
aggiefan aggiefan is offline
 
Join Date: Apr 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

We plan on releasing our contest, but aren't too sure yet. We may "sell" it for a small donation (nothing like the $50 vbpool is using). I have done a work around for now and got it almost complete (at least the NCAA type one).

The programming isn't the best, but it works. What I have so far is looking good. I expect to have it complete with a few weeks to spare before football season.
Reply With Quote
  #6  
Old 07-27-2006, 08:47 PM
jibious's Avatar
jibious jibious is offline
 
Join Date: Nov 2002
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

just let me know. if it's good (i'm assuming i can have a look on your site), i will be MORE than happy to contribute a donation. i posted on the vBPool forums with some questions a few days ago but haven't heard anything back. i'm guessing their product, especially for $50, is NOT worth the money.

i'm going to be doing a college football pick 'em, as well, so that's good on your part to do NCAA. huge Auburn fan here.. :-)
Reply With Quote
  #7  
Old 07-30-2006, 02:41 AM
aggiefan aggiefan is offline
 
Join Date: Apr 2005
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

We just upgraded to 3.6, so I'm hoping everything ports over to that. I'm nearly complete with the NCAA part. I've heard the changes between 3.5 and 3.6 shouldn't be that different, so I don't think there'll be an issue there.

I'll let you know. Texas A&M fan here -- you can tell by the website, Aggiefans.com.
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 02:42 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.04190 seconds
  • Memory Usage 2,222KB
  • 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
  • (2)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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