PDA

View Full Version : Announcements Topics on homepage



cyberturk
04-08-07, 12:10 PM
Hello

I need to insert announcemnents topics/subjects to my HTML homepage. If it is possible i need to add link to all of the subjects to the announcment page.

How can i do it?

skshost
04-08-07, 12:27 PM
I did the same thing, just use this: http://support.whmcs.com/knowledgebase.php?action=displayarticle&catid=7&id=18 and make the needed changes.

cyberturk
04-08-07, 01:16 PM
i made that but i dont need the news itself only subjects with links. so i am asking for needed changes :)

Idealws
04-18-07, 08:24 AM
Hello cyberturk,

Here is a modified version of the script which will only show the title
and the date. Once clicked it will show the announcement underneath the
annoucenments.



<?php
include("clients/configuration.php");
include("clients/includes/functions.php");
$link = mysql_connect($db_host,$db_username,$db_password);
mysql_select_db($db_name);
$query = "SELECT * FROM tblannouncements WHERE published='on' ORDER BY date DESC";
$result=mysql_query($query);
while($data = mysql_fetch_array($result)) {
$id = $data["id"];
$date = $data["date"];
$title = $data["title"];
$announcement = $data["announcement"];
$date = fromMySQLDate($date);
echo("

<a href=\"$_SERVER[PHP_SELF]?show=1&id=$id\"><font color=#cccccc>$date</font> - $title</a></p>");
}

// You can make the announcement show on a different page
// by putting the below in a different file and changing
// where is says $_SERVER[PHP_SELF] to the url of the
// file you have made.
if($show) {
$id = $_GET['id'];
$query = "SELECT * FROM tblannouncements WHERE id='$id' ORDER BY date DESC";
$result=mysql_query($query);
while($data = mysql_fetch_array($result)) {
$id = $data["id"];
$date = $data["date"];
$title = $data["title"];
$announcement = $data["announcement"];
$date = fromMySQLDate($date);
echo("

$announcement</p>");
}
}
?>


Hope this helps.

Regards,
Ray

FavHost
08-14-07, 07:33 AM
@idealws - this script doesnt seem to work properly. When I click the link, it doesnt open it, but it seems to refresh the page though. :)

rodeoXtreme
09-06-07, 03:49 PM
Great scripts but it seems that I can't even call the DB so I guess it does not work. The only output on our HTML homepage is $date - $title
$announcement"); } ?>

any suggestions would be greatly appreciated.