View Full Version : [RELEASE v2.x] OPNews v1.2 << More features!
Well, after very little effort on my behalf, i have released version 1.2.
Not much new, however-
I have added a headlines system, which is basically it ;)
Anyway, it works exactly the same way as the original, just setup a news forum(you can set its display order to 0, if you wish for noone to actually see it. i also recomend only allowing normal members to reply, not post :)
Just create a template, headlinebit and add the following
<smallfont>-></smallfont> <normalfont><a href="$forumspath/showthread.php?s=&threadid=$newsarray[threadid]">$newsarray[title]</a> by <a href=\"$forumspath/member.php?s=&action=getinfo&userid=$newsarray[postuserid]\">$newsarray[postusername]</a></normalfont><smallfont> ($dateposted)</smallfont><br>
You can customise it, and you have access to all field names in the thread table. (check out the ERD in the members area, Keir :p)
As easy as it is, to access the headlines(or include them) add
?action=headlines
or to include
<? include('/path/to/news.php?action=headlines'); ?>
Not much else i can rant about, im a bit lonely tonight :(
Anyway, heres the script:
(attached)
PS. like most scripts, just place this into your /forum/ directory, where its with its buddies(like index.php and global.php)
I just thought of another feature to add, which will come later tonight hopefully!(most commented news items, of course which would expire after a certain date offset of the current date)
again, if you have any sugestions on features youd like to see, post away, im trying to make a decent script.
Also, im trying to plan a few more features that would have customisability via admincp, for example- instead of specifying a value in the file, specify each and every forum in your forumlist thingo in admincp, stuff like that.
So knock yourselves out!(well, only if you like that sort of thing)
DjSao
08-29-2001, 08:28 AM
Well a pagenav would be good, so that if i have selected view 10 news per page then there should be a page 2 which displays 11-20 and so on.
Ill have a go at it, however i dont see why its relevant, when they can just view the forum?(i guess it depends, ill look into it later)
IanMFT
08-29-2001, 05:02 PM
argh, I've been going nuts with this. The script works, BUT I'm having problems with my smilies appearing correctly.
here's the news script slightly modified with a chdir command so the require for global.php works:
http://mainframetech.net/news.php
As you can see, the smilies don't work.
So here's the script unmodified and without the chdir command since its in my forums directory:
http://mainframetech.net/forums/news.php
So it works right?
Wrong, when I include it in a page in my / directory, here's what happens:
http://mainframetech.net/index2.php
The smilies don't appear,,,this is driving me nutso, so here's some info about the paths and vB info and the news script stuff:
Host Info
Host: Hostrocket
Absolute path to my space: /home/mftech/public_html
Relative forums dir: /forums
index2.php include path to news.php in the forums directory
<?php require("http://www.mainframetech.net/forums/news.php"); ?>
Anyone wanna help me with this? if you need more help, please ask...I'll provide it, I want to get this working.
As far as i can tell-
your settings in admincp are relative to your forum directory.
Go to your AdminCP --> Styles --> Image paths, and change /images to http://www.domain.com/forum/images
Hope that works!
IanMFT
08-29-2001, 11:41 PM
hrrrmmm...that diddn't work...I'm suspecting that host rocket is to blame. I could really care less about smilie code parsing, i just don't want a bunch of Red X's there.
The wierd thing is, I diabled smile parsing in the News forum..
Is there a function that is in global.php that will applt that forum numbers smilie settings to this little script...it can already parse vBcode and such, but there HAS to be a way to get the forum options to be applied to, ie: not to parse smilies if the forum is set not to.
Im sure there would be a method of sorts.
However, because i allow all vBCode in my forums, its a bit hard.
it envolves the function,
$cookedthread=bbcodeparse2($newsarray[pagetext],"1","1","1","1");
My sugestion would be to try and set each of the 1s to 0s one at a time and see which sort of code it disables(or look in functions.php)
IanMFT
08-30-2001, 12:05 AM
ok, i changed the second to last 1 to a 0 and it worked...thanks :)
IanMFT
08-30-2001, 12:42 AM
ok, here's another oddity....
http://www.mainframetech.net/index2.php
(I posted the problem there)
here's my newsbit template:
<table width="98%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr>
<td height="12" class="newssubject">$newsarray[title]</td>
</tr>
<tr>
<td height="12" align="left" valign="baseline" class="newsinfo">Posted By <a href="$forumspath/member.php?s=&action=getinfo&userid=$newsarray[postuserid]"><b>$newsarray[postusername]</b></a> at <i>$dateposted</i> [<a href="$forumspath/showthread.php?s=&threadid=$newsarray[threadid]">$newsarray[replycount] $commenttext</a>]</td>
</tr>
<tr>
<td colspan="2" class="smalltext">$cookedthread</td>
</tr>
</table>
<br>
odd is this one</yoda>
Ill need the $newsquery lines please.
IanMFT
08-30-2001, 05:14 AM
$newsquery = "SELECT thread.*, post.*";
$newsquery .= " FROM thread,post";
$newsquery .= " WHERE post.threadid=thread.threadid";
$newsquery .= " AND thread.forumid=$newsforums";
$newsquery .= " GROUP BY thread.threadid";
$newsquery .= " ORDER BY thread.dateline DESC";
$newsquery .= " LIMIT $newsitems";
sorry bout' that :)
Originally posted by IanMFT
newsquery = "SELECT thread.*, post.*";
$newsquery .= " FROM thread,post";
$newsquery .= " WHERE post.threadid=thread.threadid";
$newsquery .= " AND thread.forumid=$newsforums";
$newsquery .= " GROUP BY thread.threadid";
$newsquery .= " ORDER BY thread.dateline DESC";
$newsquery .= " LIMIT $newsitems";
$newsquery = "SELECT thread.*, post.*";
$newsquery .= " FROM thread,post";
$newsquery .= " WHERE post.threadid=thread.threadid";
$newsquery .= " AND thread.forumid=$newsforums";
$newsquery .= " GROUP BY thread.threadid";
$newsquery .= " ORDER BY thread.dateline DESC";
$newsquery .= " LIMIT $newsitems";
^^ Hrm, thats the one i use, and it works fine.
Might just want to try reuploading the file.
No problem about that either, just the newsbit template doesnt tell you much.
I've a problem with the query showing ups thread titles & post text.
OpNEWS doesn't display the right pagetext if there're more than 1 post in the thread.
am I the only one with problems like this ? :confused:
thanks
pier
IanMFT
08-30-2001, 05:34 PM
ok, something is REALLY screwey, i changed the 0 back to a 1(actually, i re copied the script) and its still displating the last comment instead of the news...this is quite odd. Any ideas?
I dont get this problem.
Ill look into it, give me a day.
Originally posted by IanMFT
ok, something is REALLY screwey, i changed the 0 back to a 1(actually, i re copied the script) and its still displating the last comment instead of the news...this is quite odd. Any ideas?
Yes... same problem there
That is REALLY strange.
I have this script running, here (www.opticpower.net/forum/news.php) and it works fine.
Really weird.
Im actually working on another problem atm, so could you pls post a copy of the news.php file in here(just use [php] tags)
Thanks!
IanMFT
08-31-2001, 04:03 PM
<?
error_reporting(7);
$templatesused='header,newsbit,shownews,headerbit, newsheaders';
//What is the ID of your News forum?
$newsforums = 48;
//How many news items should be displayed?
$newsitems = 10;
//Path to your forums directory (leave out trailing slash), i recomend using http://www.domain.com/forumpath
$forumspath = "/forums";
require('./global.php');
$newsquery = "SELECT thread.*, post.*";
$newsquery .= " FROM thread,post";
$newsquery .= " WHERE post.threadid=thread.threadid";
$newsquery .= " AND thread.forumid=$newsforums";
$newsquery .= " GROUP BY thread.threadid";
$newsquery .= " ORDER BY thread.dateline DESC";
$newsquery .= " LIMIT $newsitems";
$headlinequery = "SELECT thread.*";
$headlinequery .= " FROM thread";
$headlinequery .= " WHERE forumid = $newsforums";
$headlinequery .= " ORDER BY threadid";
$headlinequery .= " DESC LIMIT $newsitems";
if ($action == "headlines") {$query = $headlinequery;} else {$query = $newsquery;}
$passthruquery=$DB_site->query($query);
while ($newsarray=$DB_site->fetch_array($passthruquery)) {
//Get date in their timezone
$dateposted = vbdate("jS F Y, H:i",$newsarray[dateline]);
//If they select anything but 'headlines' as their action, assume they want news.
if ($action != "headlines") {
//You may remove this, and replace any reference to $commenttext in the templates to Coments, or use replacment variables
//Make it plural if there is more than one comment
if ($newsarray[replycount]==1) {
$commenttext = "Comment";
}
else {
$commenttext = "Comments";
}
//Process the thread, and make it parse vBcode, and stuff
$cookedthread=bbcodeparse2($newsarray[pagetext],"1","1","1","1");
//Call the template 'newsbit' for each news entry it finds in the database
eval("\$newsbits .= \"".gettemplate("newsbit")."\";");
}
//They want headlines, so they get headlines
if ($action == "headlines") {
eval("\$newsbits .= \"".gettemplate("headlinebit")."\";");
}
}
eval("dooutput(\"".gettemplate("shownews")."\");");
?>
JJR512
09-02-2001, 03:02 PM
If anyone can figure out how to make the smilies show up correctly, I'd appreciate it. I want them to actually show up, so the changing the one 1 to a 0 isn't for me.
As far as i can tell, you just need to set the full path to the images folder in the admincp
under styles
JJR512
09-03-2001, 12:38 AM
Unfortunately, as IanMFT already pointed out above, that doesn't work.
Im a bit tired atm, so excuse that post :)
Anyway, you may want to check the properties of the image that is showing as a X, and see exactly what is causing it.
Im not actually having any problems myself, but i use the news script in the forum root.
It may be a good idea, if your including news.php, to do:
<?
chdir('forum/');
include('news.php');
?>
Yer, im not sure :|
JJR512
09-03-2001, 04:53 AM
Just tried it... no good.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.