Log in

View Full Version : Help with a very small news script


tilight
11-04-2004, 10:34 PM
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
$news = mysql_query("select thread.threadid,thread.title,thread.replycount,thr ead.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], 0, 200) . "...";
$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
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 ###


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

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