View Full Version : PHP news system
Beowolf
13th Jun 2003, 08:45 PM
Though my thread is bound for sure death in the chaos of new forums, I will try anyways.
I need a powerfull php news system. I have found simple, easy to use ones, but I need more customizable ones. My site has a database (mySQL) avaible if the php news system would need that. Anyone know of any good ones?
Preferably ones that while are extensive are also pretty self-explantory. I know a lot about web languages, but am not a guru.
iridium
13th Jun 2003, 08:51 PM
If you know something about web languages, why not write your own? if you want to learn more, then that would be a good way. Unforunately I don't know any PHP scripts since I write everything myself..
Beowolf
13th Jun 2003, 08:54 PM
Well, I don't know php. I know html and css by heart, but what I really ment was that I am able to mess around with different codes and not screw everything up.
iridium
13th Jun 2003, 09:14 PM
sorry, I thought when you said web-languages, you meant PHP.
Uhm, well.. I could potentially help you build one, point you in the right direction and such.. it really isn't that hard, I promise ;)
Beowolf
13th Jun 2003, 09:16 PM
Point away!
iridium
13th Jun 2003, 09:19 PM
Do you use IRC? :)
Beowolf
13th Jun 2003, 09:21 PM
Uhh, used to. Haven't gotten trillian installed yet after my reformat.
My MSN is beowolf__@hotmail.com, though :) (two underscores)
XeneX
13th Jun 2003, 09:32 PM
This could have gone in the HTML and [Web] Programming forum. *cough* *mods* *hint* *cough* ;)
Beowolf
13th Jun 2003, 09:44 PM
Isn't that just for dealing with the Unreal Engine code?
XeneX
13th Jun 2003, 09:47 PM
Isn't that just for dealing with the Unreal Engine code?
Oh, I'm not getting at you! :)
I mentioned in IRC a couple of times about a possible new forum for web and misc programming stuffs. ;)
iridium
13th Jun 2003, 09:48 PM
nah, xenex is just suggesting that the admins create a forum specifically for this kind of question that involves web/html stuff.
Don't worry, you're not in the wrong, the forum doesn't exist.
Hunter
14th Jun 2003, 05:39 AM
iri, if i can get Jesco to help me i need to write a very very simple on for vb 3.0.0 for UF.com to extract news from the news forum, i have a script for 2.3.0 and need to hack it for 3.0.0, would you be able to help?
Beowolf
14th Jun 2003, 12:03 PM
I found a simple script that doesn't require a database. But now I need help modifying it some. It shouldn't be very hard, but everything I try turns out error messages. Would anyone be willing to help me with it?
Hunter
14th Jun 2003, 12:14 PM
what script is it?
hal
14th Jun 2003, 01:48 PM
I got your message, Beowulf, but BeyondUnreal uses a cms coded by MalHavoc. Zenny is currently writing one for a ctf site he is creating. I've used newsPHP for another site before and it's quite easy.
Good luck.
Beowolf
14th Jun 2003, 01:52 PM
hal: thanks anyways
Hunter: This one. (http://codewalkers.com/tutorials.php?show=5) The last page has the whole code put together.
Things I would be looking to change would be reverse the posted by/date and body (which, as easy as it seems, I can't do), make the news be created inside a table, and make outside links work (for some reason <a href=url>url</a> doesn't work and doesn't work; it trys to get to that address by adding it on to the-barracks.com )
EDIT: Forgot, I got some good scipts from hotscripts.com, but I can't install them. Once they get to making database tables i'm lost :(
I think my phpmyadmin is different...it came preinstalled with my host (ipowerweb) look at this pic:
Assymilator
14th Jun 2003, 02:31 PM
Hotscripts.com is a really good place for any kind of server-side code (ASP, PHP, etc).
I've installed plenty of php programs like message boards and news systems. That's what phpMyAdmin looks like, yours is just really empty.
Hunter
14th Jun 2003, 02:39 PM
<a href=url>url</a>
make sure you put http: / / in the url otherwise it will, thats all i think that problem is, also thanks for the link
Beowolf
14th Jun 2003, 04:22 PM
I tried that Hunter, it still doesn't work :mad:
Assymilator: How then do I got about creating a new table or whatever?
Hunter
14th Jun 2003, 04:27 PM
or Beo, what about putting the url in speach marks? "url"
Beowolf
14th Jun 2003, 04:32 PM
Did that too.
I tried everything associated with html and bbcode.
Hmm.
Hunter
14th Jun 2003, 04:42 PM
can lookat the content in which it is in
Beowolf
14th Jun 2003, 04:44 PM
Umm, trying to understand that sentence, you want to see how/in what situation I am trying to use it in?
The Twiggman
14th Jun 2003, 05:15 PM
Oh, I'm not getting at you! :)
I mentioned in IRC a couple of times about a possible new forum for web and misc programming stuffs. ;)
Thats such a mint idea. We do have an abundance of programmers of all sorts on here. Why not collaberate ideas with outside unreal style stuff.
Assymilator
14th Jun 2003, 06:34 PM
Well first you have to have a database. I have an older version of phpMyAdmin so I don't know what is in that dropdown menu, but you must first create a database, for instance mine is assymilator_com .
When installing php scripts, for instance phpBB2, it'll ask for your MySQL username, password, server, and database. The server for me is always localhost while the database is assymilator_com . Once you edit the specific php file the readme says to edit, you just install the program and it'll create the tables in the database by itself. Other times you'll have a MySQL file that you can upload in phpMyAdmin that will do the same thing.
Beowolf
14th Jun 2003, 07:36 PM
That's the thing, I don't see any option of creating another database. Only modifying the ones I have.
Hunter
15th Jun 2003, 06:40 AM
Umm, trying to understand that sentence, you want to see how/in what situation I am trying to use it in?
i want to see the code ;) see if i can see any bugs etc blah blah :)
Beowolf
15th Jun 2003, 08:42 AM
<?
//this should all go into one file. I would name it addnews.php
if($HTTP_POST_VARS['submit']) {
if($HTTP_POST_VARS['password'] == 'pass') {
if(!$HTTP_POST_VARS['name']) {
echo "You must enter a name";
exit;
}
if(!$HTTP_POST_VARS['news']) {
echo "You must enter some news";
exit;
}
if(strstr($HTTP_POST_VARS['name'],"|")) {
echo "Name cannot contain the pipe symbol - |";
exit;
}
if(strstr($HTTP_POST_VARS['news'],"|")) {
echo "News cannot contain the pipe symbol - |";
exit;
}
$fp = fopen('news.txt','a');
if(!$fp) {
echo "Error opening file!";
exit;
}
$line = date("m.d.y") . "|" . $HTTP_POST_VARS['name'];
$line .= "|" . $HTTP_POST_VARS['news'];
$line = str_replace("\r\n","<BR>",$line);
$line .= "\r\n";
fwrite($fp, $line);
if(!fclose($fp)) {
echo "Error closing file!";
exit;
}
} else {
echo "Bad Password";
}
}
?>
<FORM ACTION="<?=$PHP_SELF?>" METHOD="POST" NAME="newsentry">
Your name:<BR>
<INPUT TYPE="text" SIZE="30" NAME="name"><BR>
The News:<BR>
<TEXTAREA NAME="news" COLS="40" ROWS="5"></TEXTAREA><BR><BR>
News Password:<BR>
<INPUT TYPE="password" SIZE="30" NAME="password"><BR>
<INPUT TYPE="submit" NAME="submit" VALUE="Post it!"><BR>
</FORM>
That part works mostly fine, except for the edit and delete it says the password is incorrect.
<?PHP
$data = file('news.txt');
$data = array_reverse($data);
foreach($data as $element) {
$element = trim($element);
$pieces = explode("|", $element);
echo $pieces[2] . "<BR>" . "<b>Posted by " . $pieces[1] . " on " . $pieces[0] . "</b><BR><BR>";
}
?>
Theres the part that is put on the page you want it on. I want to change the posted by/on and main body, flip them around, but everything I try produces an error message. Also, I would like to get the news posted in a table that I can customize (each news post in its own table)
Beowolf
15th Jun 2003, 05:25 PM
Nobody? :(
I think I set a record today. I registered at 10 forums dealing with php asking them about news systems in one hours :)
Euphoric Beaver
15th Jun 2003, 06:00 PM
I need a powerfull php news system.
How powerful?
I coded a little news system with an admin backend quite a while back for my old site, I could zip it up and attach it if you like?
Beowolf
15th Jun 2003, 06:04 PM
Yes, please!
I don't need anything that powerfull. Just a simple news submit system, mostly text based, with aesthetic (sp) control ability (lie organizing into tables)
I have been looking at phpnuke. anyone have an expirence with that?
XeneX
15th Jun 2003, 06:14 PM
<?PHP
$data = file('news.txt');
$data = array_reverse($data);
foreach($data as $element) {
$element = trim($element);
$pieces = explode("|", $element);
echo $pieces[2] . "<BR>" . "<b>Posted by " . $pieces[1] . " on " . $pieces[0] . "</b><BR><BR>";
}
?>
<?PHP
// Here we're setting each line of news.txt as an array element to $data
$data = file('news.txt');
// We're flipping that array - to get the recent news posted first
$data = array_reverse($data);
// Iterating through each element..
foreach($data as $element) {
// Removing white space at the beginning and end of the line
$element = trim($element);
// Splitting the string into array elements.
$pieces = explode("|", $element);
// We're printing the news..
echo $pieces[2] . "<BR>" . "<b>Posted by " . $pieces[1] . " on " . $pieces[0] . "</b><BR><BR>";
}
?>
Change the last loop to the following..
<?php
// Iterating through each element..
foreach($data as $element) {
// Removing white space at the beginning and end of the line
$element = trim($element);
// Splitting the string into seperate variables.
list($date, $poster, $news) = explode("|", $element);
// We're printing the news..
echo "<b>Posted by " . $poster . " on " . $date . "</b><BR><BR>", $news, "<BR><BR>";
}
?>
Fomhoire
16th Jun 2003, 01:30 AM
I've been playing around with PhpNuke and PostNuke. Both are easy to use and set up. I like PhpNuke's layout slightly better than PostNuke, but overall there is little difference.
I'm probably going to go with PostNuke because the guy that writes PHPnuke suddenly decided he is going to charge for PhpNuke, even though it is GPL software. If you can find the latest version (which is 6.7) you are entitled to download it and use it for free, but that isn't what he feels about it.
I don't have a problem with charging for software, I have a problem with charging for GPL software.
A good site for PostNuke mods and themes: http://www.pntm.com/
There is also phpWebsite (http://phpwebsite.appstate.edu/), but there aren't many modules available for it. PHPGirl (http://www.phpgirl.com/) is a fair example of this PHP CMS.
Also, you might want to look at the various PHP CMSs available.
http://myphpnuke.com/ is a fork off of PhpNuke. You can do a search for CMS on Sourceforge and get several others returned in the search results.
If you don't have Mozilla I would suggest downloading it and using the "What's Related" feature to pull of relevant pages. Go to http://www.postnuke.com and then press F9. You will get a few pages about PostNuke and other related pages. Sometimes this is better than using Google for finding information.
Euphoric Beaver
16th Jun 2003, 04:40 AM
I haven't tested it Beo but it should be working, reply if you have any problems. :)
Remember to edit jkldsa.php putting in your username, pass and database name and to create the four tables, ID, Headline, Comments and Date.
Beowolf
16th Jun 2003, 07:57 AM
Does this require a database?
<?php
$db = mysql_connect("localhost", "cunning-play", "kxsccunning-play");
mysql_select_db("cunning-play",$db);
?>
Umm, which one is the pass and which one is the user name?
Beowolf
16th Jun 2003, 09:21 AM
I DL'ed phpnuke 6.5 since that was the only one I could find, but it is only one file (GZ file php-nuke-6.5.tar) and I have no clue what to do with it, since windows cant read it.
what is the latest version of postnuke?
Euphoric Beaver
16th Jun 2003, 10:05 AM
Does this require a database?
<?php
$db = mysql_connect("localhost", "cunning-play", "kxsccunning-play");
mysql_select_db("cunning-play",$db);
?>
Umm, which one is the pass and which one is the user name?
Yupper requires a database.
Username:Password
iridium
16th Jun 2003, 10:41 AM
Does this require a database?
<?php
$db = mysql_connect("localhost", "cunning-play", "kxsccunning-play");
mysql_select_db("cunning-play",$db);
?>
Umm, which one is the pass and which one is the user name?
cunning-play = user
kxsccunning-play = pass
localhost = host
cunning-play = database
Fomhoire
16th Jun 2003, 12:53 PM
I DL'ed phpnuke 6.5 since that was the only one I could find, but it is only one file (GZ file php-nuke-6.5.tar) and I have no clue what to do with it, since windows cant read it.
what is the latest version of postnuke?
.723 is the latest version of PostNuke.
You can download it here: http://download.hostnuke.com/pafiledb.php?action=category&id=1
Under main releases.
Hunter
16th Jun 2003, 01:41 PM
can i suggest that you stay away from content managments systems because they can stop your own designs.
i'd suggest newsPHP because it doesnt need a database
Euphoric Beaver
16th Jun 2003, 03:05 PM
If you have a database and a bit of free time, it's worth reading up on the various mysql_querys that can be done. You can do some pretty funky stuff like randomising and ordering the output and can pretty much run an entire site with just a few simple input pages. :)
Hunter
16th Jun 2003, 03:09 PM
yeah well why do u think god invented summer? so i could learn php and mysql etc :D
*edit* how do u get urs working i'm getting server errors
Euphoric Beaver
16th Jun 2003, 03:22 PM
Talking to me about the server errors?
What errors are you getting exactly?
Hunter
16th Jun 2003, 03:32 PM
just internal server errors, u got a sql query which will add the tables auto?
Euphoric Beaver
16th Jun 2003, 03:39 PM
Nope I add them by hand.
Beowolf
16th Jun 2003, 05:01 PM
i'd suggest newsPHP because it doesnt need a database
Link please?
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.