hi guyz, i want to create an archive for my website entries (news,articles....etc) can anybody help?

appreciate the answer

Member Avatar for GreenDay2001

I think you want a Content Management System(CMS). Try Mambo or Joomla.

Member Avatar for diafol

Are these posts online already? Do you want to archive in the 'store away from view' sense, in the 'backup' sense or do you just need a blog like WordPress or CMS like Joomla?

Are these posts online already? Do you want to archive in the 'store away from view' sense, in the 'backup' sense or do you just need a blog like WordPress or CMS like Joomla?

assuming these are posts stored in db, how to archive them?
i'm developing my own php website i dnt want to use jooomla or any other ready made CMS

thanx 4 reply

Are these posts online already? Do you want to archive in the 'store away from view' sense, in the 'backup' sense or do you just need a blog like WordPress or CMS like Joomla?

assuming these are posts stored in db, how to archive them?
i'm developing my own php website i dnt want to use jooomla or any other ready made CMS

thanx 4 reply

Member Avatar for diafol

Simply place a 'status' (tinyint, length = 1, default = 0) field at the end of the table.
You can have two or more values, e.g.

0 means current (so all posts are current by default)
1 means archived (so not shown by default but available through "archives page"
2 means inactive - these posts, although you don't want to delete them, will not be available for Joe Public to see.

For 'archived':
"SELECT * FROM posts WHERE status = 1 ORDER BY post_time DESC"
For 'current'
"SELECT * FROM posts WHERE status = 0 ORDER BY post_time DESC"
For all viewable:
"SELECT * FROM posts WHERE status <> 2 ORDER BY post_time DESC"

$r = mysql_query("SELECT * FROM posts WHERE status = 1 ORDER BY post_time DESC");
if($mysql_num_rows > 0){
   $output = "";
   while($d= mysql_fetch_array($r)){
       $output .="\n<h3 class=\"posttitle\">" . stripslashes($d['title']) . "</h3>";
       $output .="\n<p class=\"author\">by " . stripslashes($d['author']) . " on " . stripslashes($d['post_time']) . "</p>";
       $output .="\n<div class=\"abstract\">" . stripslashes($d['post_abstract']) . "</div>";
       $output .="\n<p class=\"readmore\"><a href=\"mainarticle.php?id={$d['id']}\">Read more...</a></p>";
   }
}else{
  $output = "Sorry no posts available";
}

...rest of page...

echo $output;

...rest of page...

That's just my prototype take on producing a list of posts with abstracts - similar to a news feed. The link at the bottom of each feed then takes you to the main article in full (via the 'id' querystring parameter). You just pick that up in the next page with the $_GET whatsit.

Hope that's what you were looking for. It's not tested and required some work for a production site.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.