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

Reply
 
Thread Tools Display Modes
  #1  
Old 08-03-2004, 07:19 PM
Blue Moose Aaron's Avatar
Blue Moose Aaron Blue Moose Aaron is offline
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Jump Menu

I want to create a jump menu that will display the id and name of all the records in a certain table. I figured out how to do it with my individual php file, but now Im trying to get it to work with vB and templates.

Any ideas?
Reply With Quote
  #2  
Old 08-03-2004, 08:52 PM
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Location: Norway
Posts: 1,671
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This will most likely not work, but you can try this:

In your vb php file put summit like this:
PHP Code:
$options .= "<option value='".$row[contents]."'>".$row[contents]."</option>";
$options .= "<option value='".$row[contents2]."'>".$row[contents2]."</option>"
Then in your template put summit like this:
PHP Code:
<select name="selection">$options</select

hopefully ye get the picture.
if not, then in plain words if you put .= infront of a variable you add it to the var instead of overwriting current value.

Hopefully this wasnt just me talking bs ?
Reply With Quote
  #3  
Old 08-04-2004, 04:27 AM
Blue Moose Aaron's Avatar
Blue Moose Aaron Blue Moose Aaron is offline
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I originally had it set up like this and it displays all the records (http://www.thekryptonian.com/smallville.php)

PHP Code:
<select onChange="location=options[selectedIndex].value;">
                    <option selected> Choose an Ep  </option>
                              <?
        $result = mysql_query("SELECT * FROM smallville_episode_guide ORDER BY id ASC",$db);
        $php_self = $_SERVER['PHP_SELF'];
        while ($myrow = mysql_fetch_array($result)) {
printf("<option value=\"%s?action=episodeguide&episode=%s\">---%s - %s</option> \n", $php_self, $myrow['id'], $myrow['id'], $myrow['episode_name']);
        }
        
        
      ?></select>
I just need to find out how to make that code work with vB cause its not!
Reply With Quote
  #4  
Old 08-04-2004, 02:45 PM
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Location: Norway
Posts: 1,671
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If it works in another php file then it works with vB as well, so your problem is to ave it echo in the template.
maybe summit like this:

In your template:
PHP Code:
<select onChange="location=options[selectedIndex].value;">
                    <
option selectedChoose an Ep  </option>
                    
$options                   
</select
In your php file:
PHP Code:
        $result mysql_query("SELECT * FROM smallville_episode_guide ORDER BY id ASC",$db);
        
$php_self $_SERVER['PHP_SELF'];
        while (
$myrow mysql_fetch_array($result)) {
$options "<option value='%s?action=episodeguide&episode=%s'>---%s - %s</option> \n"$php_self$myrow['id'], $myrow['id'], $myrow['episode_name'];
        } 
Basically just stick all your episode query results into a variable, and have this echo in the template....
Reply With Quote
  #5  
Old 08-04-2004, 08:44 PM
Blue Moose Aaron's Avatar
Blue Moose Aaron Blue Moose Aaron is offline
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I get an error with that The , coma on this line gets me "<option value='%s?action=episodeguide&episode=%s'>---%s - %s</option> \n", $php_self, $myrow['id'], $myrow['id'], $myrow['episode_name'];
Reply With Quote
  #6  
Old 08-04-2004, 10:47 PM
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Location: Norway
Posts: 1,671
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hm well then just look at other hacks/vb itself and see how they do it.

Take a look at the forumjump stuff for example, this is similar to your issue in the way that its a <select>, and its <option>'s is dynamic
Reply With Quote
  #7  
Old 08-04-2004, 11:16 PM
Blue Moose Aaron's Avatar
Blue Moose Aaron Blue Moose Aaron is offline
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am, but I'm having a time finding where forumjumpbits is...

Thanks for your help so far, maybe someone will come along with some idea.

On a positive note I have got it to display, the only problem left is that it is only diplaying one record rather than all of them.
Reply With Quote
  #8  
Old 08-04-2004, 11:39 PM
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Location: Norway
Posts: 1,671
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you try the .= to print all the results into the variable?
This SHOULD work because its the same concept that saved my ass in the RPG convertion
Reply With Quote
  #9  
Old 08-05-2004, 12:06 AM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you should not hardcode such things

here is the html:
HTML Code:
<select onChange="location=options[selectedIndex].value;"> 
                    <option selected> Choose an Ep  </option> 
                    $options                    
</select>
here is php
PHP Code:
eval('$options .= "' fetch_template('templatename') . '";'); 
in that template put:
HTML Code:
<option value="$variable1">$variable2</option>
Reply With Quote
  #10  
Old 08-05-2004, 12:43 AM
Blue Moose Aaron's Avatar
Blue Moose Aaron Blue Moose Aaron is offline
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well that worked, but its only displaying one record rather than all of them. Any suggestions?
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 07:17 AM.


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.06003 seconds
  • Memory Usage 2,272KB
  • 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
  • (2)bbcode_html
  • (6)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
  • (2)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_postinfo_query
  • fetch_postinfo
  • 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