DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • October 22, 2017, 03:46:45 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Admin add news & news on village square  (Read 3510 times)
0 Members and 1 Guest are viewing this topic.
anpera
Guest
« on: February 19, 2004, 08:37:30 PM »

Ok, this is just a little one and I don't know if it makes
any sense on big servers. I liked the idea of being able
to inform players easily about small changes, errors, and
other things in an RP-style this way. Smiley

It adds an input field on top of the daily news where
admins can enter new news manually.

The second part displays the latest headline on village square.

Code:
----- PART I

----- Open:
news.php

----- Find:
$newsperpage=50;

----- After add:
page_header("LoGD News");
if ($session[user][superuser]==3){
output("`0<form action=\"news.php\" method='POST'>",true);
output("[Admin] Insert News? <input name='meldung' size='40'> ",true);
output("<input type='submit' class='button' value='Insert'>`n`n",true);
addnav("","news.php");
if ($_POST[meldung]){
$sql = "INSERT INTO news (newstext,newsdate,accountid) VALUES ('".addslashes($_POST[meldung])."',NOW(),0)";
db_query($sql) or die(db_error($link));
$_POST[meldung]="";
}
addnav("","news.php");
}

----- Find below:
page_header("LoGD News");

----- Replace it with:
// page_header("LoGD News");


---- PART II

----- Open:
village.php

----- Find:
output(" You see various shops and businesses along main street. There is a curious looking rock to one side. ");

----- After, add:
$sql = "SELECT * FROM news WHERE 1 ORDER BY newsid DESC LIMIT 1";
$result = db_query($sql) or die(db_error(LINK));
$news = db_fetch_assoc($result);
output("On it you can read the latest news:`n`n`0`c`i$news[newstext]`i`c`n`0");


----- Save and close all files
Logged
strider
Guest
« Reply #1 on: February 20, 2004, 09:19:47 AM »

I guess I didn't read this through the first time I saw it on Sourceforge. Very cool, I've been adding things the hard way. GREAT MOD Anpera. . .

-Strider
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
18 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search