Jump to content

Announcements


Adamski

Recommended Posts

Hi

 

I'm using this code:

 

<?php
include("whmcs/configuration.php");
include("whmcs/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("<div class='left_date'>$date</div><div class='left_comment'>$title</div><div class='hr'><hr /></div>");
}
?>

 

To include the announcement title and date on my front page but I need some help.

 

1. Date is displayed 2007-5-21. How can I change this to be Day and Month (preferably name of month)?

2. How can I make either the date or the title a link to go to the announcements page? I've worked that one out as you can only link to page and not announcements within page!

3. Is there a way of just pulling the 3 most recent announcements?

 

Thanks muchly for any help, mysql is a definate weak spot for me!

 

Adam

Link to comment
Share on other sites

Thanks datahosts,

 

Pretty much the script I'm using (which I got from the knowledgebase). I've just chopped out the announcement detail.

 

There was nothing in that post that helped with my questions and the dowload isn't available anymore.

 

I've found out about MySQL date_format but not sure how to implement it so I will keep hunting.

 

Thanks,

 

Adam

Link to comment
Share on other sites

Thanks :)

 

I have changed

$date = fromMySQLDate($date);

for

$date = date("js M);

which displays how I want, but only todays date. I assume because it isn't referencing the database.

 

I will continue playing. To be honest the date's I can live with as I know I will get round that but it's only displaying the last 3 annoucnements that has me :)

 

AD

Link to comment
Share on other sites

  • 2 months later...
How about a code that shows like this:

 

Date - Title

Teaser of subject ...READ MORE

 

Having a teaser of the announcement subject (maye 10 words long) followed by a ...Read More

 

Any suggestions?

 

if your using smarty, u can use the modifier called "truncate"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated