homepage Welcome to WebmasterWorld Guest from 54.204.79.235
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
php blog(ish)
creating a blog for a client need some info
togethercomms




msg:3935936
 1:54 pm on Jun 18, 2009 (gmt 0)

Hi everyone.
I am creating a type of blog for a client that he can write to.
I have made the script that stores the new data and displays it from MySQl database.
But the thing i really need help n is the auto-archive feature.
The reason for this is because i want the newest blogs on the first page and the old ones get archived and brings up a link to the old blog at the top of the page.

I think this is possible but after thinking about it i have not a clue how this could be innitiated, any help would be greatly appreciated (I know everyone on here is so helpful)

If you dont understand please let me know and i'll try and simplify it.

Many Thanks

 

jatar_k




msg:3936011
 3:03 pm on Jun 18, 2009 (gmt 0)

to get the newest content on the main page you just select by date desc, if you set a limit then the older ones will just drop off as more are posted

for the link just select the story with the max id, I assume there is an id of some kind. You could also select by date descending and limit to 1 result

togethercomms




msg:3936057
 3:48 pm on Jun 18, 2009 (gmt 0)

So for the archive links at the top, how would they automatically happen? and could i put a date in big bold header of when the blog was produced?

jatar_k




msg:3936074
 4:09 pm on Jun 18, 2009 (gmt 0)

most blogs group by date or category so you could do your archives using 1 of those options I would think.

togethercomms




msg:3936552
 8:06 am on Jun 19, 2009 (gmt 0)

how would i go about this?

jatar_k




msg:3936728
 1:33 pm on Jun 19, 2009 (gmt 0)

just as an aside, why are you recoding the wheel on this? Especially if it is for a client, There is a ton of blog software out there. Just wondering ;)

I would suggest getting some of that software and studying how it does the things you want to do, you can then reproduce it more easily.

each post would need to be in a category
you could then write a select query that does what I laid out

to list the number in a cat
select count(post_id) as totalposts from posts where cat_id=3

then a page of listings, newest to oldest
select * from posts where cat_id=3 order by postdate desc limit 10

or something of that nature

tomhumf




msg:3936789
 2:43 pm on Jun 19, 2009 (gmt 0)

Before you try and order by date, are you actually storing the date in a field with the post?

If not look at the mysql date and time functions, especially NOW() to store the current time with the post.

togethercomms




msg:3938119
 11:42 am on Jun 22, 2009 (gmt 0)

i have decided to use and adapt b2 evolution blog which is great because i can learn while im doing it.

It's a pain not knowing probaly the most simplest things.
I've been doing this now for 9 months and all self taught, so thank you all for your help

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved