Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
Over my head?? Details »»
Over my head??
Version: , by jsell jsell is offline
Developer Last Online: Sep 2004 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 09-06-2002 Last Update: Never Installs: 0
 
No support by the author.

Hey everyone first of all i would like ot thank you in advance for the help but here it goes

i am trying to hack my own "admin Recommended" type of hack where I replace the post icon's with a yes or a no icon at my choosing. I want it to show up in the forumdisplay when i choose if i want to reccomend the thread or not. I have everything working except it doesn;t diplay the icon's correctly. obviously there is soemthing wrong with my code. I am pretty new to php and to Vbulletin so please go easy one me.

PHP Code:
// reco hack

unset($recodata);
unset(
$reco);

   
    
    
$recodata=$DB_site->query("SELECT reco from recodata data WHERE threadid='$threadid'");
                   
      if ((
$recodata[recomend]==1)) {
        eval(
"\$reco= \"".gettemplate("reco_yes")."\";");

      } else {
    
        eval(
"\$reco= \"".gettemplate("reco_no")."\";");
      }
    }
  


//end add reco hack 
above is the code i am using in forumdisplay.php

what happens is that is displays only the "reco_no" template

it's like it's either not getting the info from the query or it's using the same info for every thread (i think)

can some one please help

again thanks

Jsell

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 09-07-2002, 04:42 AM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this jsell:

PHP Code:
// reco hack

    
$recodata=$DB_site->query("SELECT reco FROM recodata WHERE threadid='$threadid'");
                   
      if (
$recodata[reco]==1) {
        eval(
"\$reco= \"".gettemplate("reco_yes")."\";");

      } else {
    
        eval(
"\$reco= \"".gettemplate("reco_no")."\";");
      }  

//end add reco hack 
Youre problem was that you were not getting the values of the query into an array. Whenever you create a array from a query, you must put it in $array[element] form. "element" is usually the name of the column selected in the array. You had a number of small syntax errors in the code.

Also, because this is getting values of many threads, you need to put the code in a while loop, and fetch or extract the array. This while loop has already been made in forumdisplay.php ofcourse.

So in forumdisplay.php, find:
PHP Code:
while ($thread=$DB_site->fetch_array($threads)) { // and $counter++<$perpage) { 
And below it place your code.

Try the above code, I hope it works since I'm not all that sure what you are doing.
Reply With Quote
  #3  
Old 09-07-2002, 03:49 PM
jsell jsell is offline
 
Join Date: Nov 2001
Location: South USA
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your help Velocd but there is still a problem:

let me try a more detailed explination and tell you some more test's I have run

What i have done is I added a input field in "showthread" where I can select yes/No for if I recomend a thread to a user to read. For now I am going to replace the message icon with a yes/no icon in the forum display (later I will add a new box in the table for it so I have both icon's) evrythign is wokring except the forum display in thee database if I choose "yes" it enters a value of 1 if i choose "no" i enters a value of 2 etc.

what happens when i enter the code in "forumdisplay.php" your's or mine, is that every thread show's the same icon the icon inside the "reco_no" template.

So to try to test this in the forumdisplaybit template i put the variable $recodata[reco] and it comes up as a blank for every thread even though the database has value's for all of them

My conclusion:

that for some reason the Query is not getting the info form the database (double and triplechecked the table names etc. ) but I can't figure out why it's doing that maybe the
PHP Code:
WHERE threadid='$threadid' 
part is incorrect but i can't find diferent variable to use

jsell
Reply With Quote
  #4  
Old 09-09-2002, 12:07 AM
jsell jsell is offline
 
Join Date: Nov 2001
Location: South USA
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the help I found a workaround for this that does what i need

jsell
Reply With Quote
Reply

Thread Tools

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 05:38 PM.


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.16141 seconds
  • Memory Usage 2,238KB
  • Queries Executed 19 (?)
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
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (3)postbit
  • (4)postbit_onlinestatus
  • (4)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete