vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Help with a very small news script (https://vborg.vbsupport.ru/showthread.php?t=71363)

tilight 11-04-2004 10:34 PM

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.

Andreas 11-04-2004 10:52 PM

  • 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 ;))

tilight 11-04-2004 11:14 PM

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') . '");');

Andreas 11-04-2004 11:16 PM

Quote:

thread.threadid,thread.title,thread.replycount,thr ead.postusername,thread.dateli ne,post.postid,post.pagetext
Can you see the space now?

tilight 11-04-2004 11:39 PM

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?

tilight 11-05-2004 07:05 PM

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.

Andreas 11-05-2004 07:09 PM

Hmm, is working just fine on my board. Do you use table-prefixes?

tilight 11-05-2004 07:34 PM

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.

tilight 11-06-2004 01:04 PM

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.

tilight 11-11-2004 12:07 AM

Found my problem!!! I needed

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

In index.php


All times are GMT. The time now is 07:40 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.01210 seconds
  • Memory Usage 1,743KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete