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

Reply
 
Thread Tools Display Modes
  #1  
Old 11-04-2004, 10:34 PM
tilight tilight is offline
 
Join Date: Dec 2003
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Help with a very small news script

Hello,

Im trying to install a news hack ( https://vborg.vbsupport.ru/showthread.php?t=70648 ) the thing thats making it not work is in index.php I had to put this:

PHP Code:
<?php
$news 
mysql_query("select thread.threadid,thread.title,thread.replycount,thread.postusername,thread.dateline,post.postid,post.pagetext from thread,post where thread.forumid=4 and post.postid=thread.firstpostid group by thread.firstpostid order by threadid desc limit 4;"); 

$n 0
while(
$newsitem mysql_fetch_row($news)){ 
    
$n++; 
    
$newstitle[$n]=$newsitem["1"]; 
    
$newsreply[$n]=$newsitem["2"]; 
    
$newsuser[$n]=$newsitem["3"]; 
    
$newsdate[$n]=vbdate("D j M Y, g:i A",$newsitem["4"]); 
    
$newsthread[$n]=$newsitem["5"]; 
    
$limittext[$n]=parse_bbcode($newsitem["6"]); 
    
$newstext[$n] = substr($limittext[$n], 0200) . "..."
    
$newsavatar[$n]=$newsitem["7"]; 
}
?>
between the 2 eval's after // ### ALL DONE... and it gives me a blank page, could anyone please help me? The problem is not in the template.

thanks a mil.
Reply With Quote
  #2  
Old 11-04-2004, 10:52 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

  • Don't use the <?php and ?> lines in the above code if you use this within vBs index.php
  • There is a space where there should not be one: dateli ne should be dateline
  • You should use $DB_site->query() instead of mysql_query () as the class does some error handling which the raw functions don't provide. furthermore this follows vBulletin coding standards.
    (And use associative arrays, but this is beyond the scope of your problem )
Reply With Quote
  #3  
Old 11-04-2004, 11:14 PM
tilight tilight is offline
 
Join Date: Dec 2003
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm ok ive done the new db_site->query and I couldnt find the dateline thing. But here is what I have (an excert from my index.php file)

The page still shows blank.

// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ###

eval('$navbar = "' . fetch_template('navbar') . '";');

// ### news ###

$news = $DB_site->query("select thread.threadid,thread.title,thread.replycount,thr ead.postusername,thread.dateli ne,post.postid,post.pagetext from thread,post where thread.forumid=2 and post.postid=thread.firstpostid group by thread.firstpostid order by threadid desc limit 4;");

$n = 0;
while($newsitem = mysql_fetch_row($news)){
$n++;
$newstitle[$n]=$newsitem["1"];
$newsreply[$n]=$newsitem["2"];
$newsuser[$n]=$newsitem["3"];
$newsdate[$n]=vbdate("D j M Y, g:i A",$newsitem["4"]);
$newsthread[$n]=$newsitem["5"];
$limittext[$n]=parse_bbcode($newsitem["6"]);
$newstext[$n] = substr($limittext[$n], 0, 200) . "...";
$newsavatar[$n]=$newsitem["7"];
}

// ### news ###

eval('print_output("' . fetch_template('FORUMHOME') . '");');
Reply With Quote
  #4  
Old 11-04-2004, 11:16 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
thread.threadid,thread.title,thread.replycount,thr ead.postusername,thread.dateli ne,post.postid,post.pagetext
Can you see the space now?
Reply With Quote
  #5  
Old 11-04-2004, 11:39 PM
tilight tilight is offline
 
Join Date: Dec 2003
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What the... I am looking at it right now, exactly what I pasted and there is no dateli ne its just dateline hmmm.... I'll paste again, its still giving me a blank page

// ### news hack ###

$news = $DB_site->query("select thread.threadid,thread.title,thread.replycount,thr ead.postusername,thread.dateline,post.postid,post. pagetext from thread,post where thread.forumid=2 and post.postid=thread.firstpostid group by thread.firstpostid order by threadid desc limit 4;");

$n = 0;
while($newsitem = mysql_fetch_row($news)){
$n++;
$newstitle[$n]=$newsitem["1"];
$newsreply[$n]=$newsitem["2"];
$newsuser[$n]=$newsitem["3"];
$newsdate[$n]=vbdate("D j M Y, g:i A",$newsitem["4"]);
$newsthread[$n]=$newsitem["5"];
$limittext[$n]=parse_bbcode($newsitem["6"]);
$newstext[$n] = substr($limittext[$n], 0, 200) . "...";
$newsavatar[$n]=$newsitem["7"];
}

// ### news hack ###


[EDIT] OMG! why i it showing dateli ne in here and dateline in my text?!?!?!.... investigating[/EDIT]

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaa

Ok there isnt actually a space in the dateline... this forum just creates a space if there are too many chars close together.

but its still not working, any help?
Reply With Quote
  #6  
Old 11-05-2004, 07:05 PM
tilight tilight is offline
 
Join Date: Dec 2003
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone have a clue? It's not dateline, that was just a vb.org forum bug. It's still showing a blank page... I have no clue why.
Reply With Quote
  #7  
Old 11-05-2004, 07:09 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm, is working just fine on my board. Do you use table-prefixes?
Reply With Quote
  #8  
Old 11-05-2004, 07:34 PM
tilight tilight is offline
 
Join Date: Dec 2003
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm weird. I just tried it again with forumid 4 (which has NO posts in it) and it worked. But then I changed ti to forum 2 which has 2 posts in it and it shows up blank.
Reply With Quote
  #9  
Old 11-06-2004, 01:04 PM
tilight tilight is offline
 
Join Date: Dec 2003
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there another way I could organize the queries to the DB? Im thinking thats the problem... Because creating variables wouldnt make a blank page I don't think.
Reply With Quote
  #10  
Old 11-11-2004, 12:07 AM
tilight tilight is offline
 
Join Date: Dec 2003
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Found my problem!!! I needed

require_once('./includes/functions_bbcodeparse.php');

In index.php
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 12:32 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.04900 seconds
  • Memory Usage 2,259KB
  • 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
  • (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
  • (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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete