Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
Prev Previous Post   Next Post Next
  #5  
Old 02-09-2005, 01:50 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah my initial idea was gonna be a query per group but if you have 12 catergories that's like an additional 12 queries per page, not good.

Quote:
Originally Posted by KirbyDE
I don't understand what you actually want to retrieve.

Can you give some example data and what you want to have returned?
an example would be (to elablorate on marco) i have

a table (catergories)
catid title description
1 Automotive For groups referring to cars, bikes or such
2 Computers For groups referring to computers, whether hardwar...
3 Education For groups regarding learning, whether it be help ...
4 Entertainment For groups surrounding anything entertaining, visu...
5 Games For groups surrounding games you love, digital or ...
6 Health & Fitness For groups pertaining to well-being
7 Home & Families For groups regarding the home life
8 Lifestyles For groups surrounding lifestyles whether it be go...
9 Places & Travel For groups referring to towns, cities and holidays
10 Religion & Belief For groups surrounding christianity, islam, buddis...
11 Sports & Recreation For groups referring to sports, whether it be Foot...
12 Others For everything else

now these are leftjoined to a groups table so it will display all groups that fall into each catergory, however i went to make it so it shows a maximum of ten records for each catid

here's the code that pulls this data from the database
PHP Code:
            $grps_categories $DB_site->query("
                SELECT grps.groupid, grps.title, grps.description, grps.catid, grps_catergories.title AS catname, grps.approved, grps.leaderid
                FROM grps
                LEFT JOIN grps_catergories ON (grps_catergories.catid = grps.catid)
                WHERE grps.approved=1
                ORDER BY grps_catergories.catid ASC, grps.title ASC
            "
);

            if (!
$DB_site->num_rows($grps_categories))
            { 
// no groups, this becomes obselete after the first group gets created
                        
eval("\$grps_catbits = \"" fetch_template("groups_browse_cathead") . "\";");
                        
$grps_catbits .= "<tr><td class=\"alt1\" align=\"center\">no groups found in this catergory at this time</td></tr>";
                        eval(
"\$grps_catbits .= \"" fetch_template("groups_browse_catfoot") . "\";");
            }
            else
            { 
// display the information
                
$row "0";
                while (
$grps_categoryinfo $DB_site->fetch_array($grps_categories))
                {
                    if (
$row == 0)
                    {

                        eval(
"\$grps_catbits .= \"" fetch_template("groups_browse_cathead") . "\";");

                        
// reset catname store
                        
$grps_catidstore $grps_categoryinfo['catid'];
                        
$seperator TRUE;
                    }

                    if (
$grps_catidstore != $grps_categoryinfo[catid] AND $row != 0)
                    {
                        eval(
"\$grps_catbits .= \"" fetch_template("groups_browse_catfoot") . "\";");
                        eval(
"\$grps_catbits .= \"" fetch_template("groups_browse_cathead") . "\";");
                    }

                    
$grps_categoryinfo['title'] = stripslashes($grps_categoryinfo['title']);
                    
$grps_categoryinfo['description'] = nl2br(stripslashes($grps_categoryinfo['description']));
                    
$grps_categoryinfo['catname'] = stripslashes($grps_categoryinfo['catname']);

                     eval(
"\$grps_catbits .= \"" fetch_template("groups_browse_catbit") . "\";");

                    if (
$grps_categoryinfo[catid] != $grps_catidstore)
                    {
                        
// reset catname store
                        
$grps_catidstore $grps_categoryinfo['catid'];
                    }
                    
$row++;
                } 
//now echo the date into the template
                
eval("\$grps_catbits .= \"" fetch_template("groups_browse_catfoot") . "\";");
            } 
thinking about it, couldn't i add a counter for the catergory and then if it reaches 10 then not echo the template till the catid changes? or would that be intensive on the server resources?
Reply With Quote
 

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 11:13 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.05329 seconds
  • Memory Usage 2,471KB
  • Queries Executed 12 (?)
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)bbcode_php
  • (1)bbcode_quote
  • (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)showthread_list
  • (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_threadedmode.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_threaded
  • showthread_threaded_construct_link
  • 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