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

Reply
 
Thread Tools Display Modes
  #11  
Old 01-02-2009, 05:32 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You don't seem to be looping the $menus_array, but rather, just referencing it using a set key. So I don't know what the order of the array has to do with anything.
Reply With Quote
  #12  
Old 01-02-2009, 05:45 AM
Dax IX Dax IX is offline
 
Join Date: Jul 2005
Posts: 153
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll study it a little more, but this seems to give me EXACTLY what I'm looking for:

PHP Code:
$planner_rows 3;
$planner_columns 7;
$meals = array("Breakfast","Lunch","Dinner");
$days_of_week = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

if(
$vbulletin->userinfo['userid']){

$planners $vbulletin->db->query_read("
    SELECT *
    FROM " 
TABLE_PREFIX "planners
    WHERE memberid = " 
$vbulletin->userinfo['userid'] . "
    ORDER BY id DESC LIMIT 1
"
);



$planners_array = array();
$planners_array[] = $vbulletin->db->fetch_array($planners);

$menuids $planners_array[0][menuids];

$menus $vbulletin->db->query_read("
    SELECT id, shortdescription
    FROM " 
TABLE_PREFIX "menus
    WHERE id IN (
$menuids)
"
);

}

$menus_temp = array();
while (
$menu $vbulletin->db->fetch_array($menus))
{
    
$menus_temp[$menu[id]] = $menu;
}

$menus_array = array();
$id_order explode(','$menuids);

foreach (
$id_order AS $id)
{
    
$menus_array[] = $menus_temp[$id];
}

echo 
"<table style='border:none;width:1070px;'>
    <tr>
        <td style='border:none;width:70px'>&nbsp;</td>"
;
for(
$n 0$n $planner_columns$n++) {
    echo 
"        <td style='color:#FF0000;width:140px;border:none;padding:5px;'><strong>" $days_of_week[$n] . "</strong></td>";
}
echo 
"    </tr>";
for(
$i 0$i $planner_rows$i++) {
    echo 
"    <tr>
        <td style='color:#FF0000;width:70;border:none;text-align:right;padding-right:5px;'><strong>" 
$meals[$i] . "</strong></td>";
        
$list_menu $i;
        for(
$ii 0$ii $planner_columns$ii++) {
            echo 
"<td style='width:140;border:1px solid black;padding:5px;'>" . ($list_menu +1) . " " $menus_array[$list_menu]['shortdescription'];

            
$list_menu += $planner_rows;
            echo 
"</td>";
        }
    echo 
"</tr>";
}
echo 
"</table>"
Thank you so much for your help!

I'm not sure exactly how yet, but originally it was listing the menu descriptions in the order that they were entered into the database instead of by the order that they're listed in $menuids. But with your help I was able to get them to display exactly how I want them.

Thank you again!

--------------- Added [DATE]1230882971[/DATE] at [TIME]1230882971[/TIME] ---------------

Unless you have something that you really want to point out with this script the way I have it, this can be marked as SOLVED.

Thanks again!
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 11:06 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.04437 seconds
  • Memory Usage 2,191KB
  • 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_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
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)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