/    Sign up×
Community /Pin to ProfileBookmark

Blog System

This evening I decided it would be fun to reinvent the wheel, (create my own blogging system). I’m wondering how others who have done this (Ryan, Daniel, Conor), have structured your databases?
I was considering 1 table for posts and 1 for comments, or maybe 1 table per post (probably not though). Anyways, how have you all went about this?

to post a comment
PHP

17 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliMay 21.2004 — I have not develoveloped any blogging system,but I have done tonne of DB design.

If you require a good design then you must use a number of tables for almost everything.Keep everything separate if you can,say like user info,logins,threads and so on...as modular as you can make it the better it will be.
Copy linkTweet thisAlerts:
@SamauthorMay 21.2004 — so, would you go so far as to say keep each post in its own table with comments for said post also in their own table, or maybe each post and its comments in a table, or what?
Copy linkTweet thisAlerts:
@deraMay 22.2004 — i tried making from scratch but i didnt no much about sql etc. so i got an edge content manager which [URL=http://admenswear.com/derango/]my site[/URL] uses now, and you can reply to posts etc, users can create there own blogs etc. its a great start for source code etc. you can get the code from [URL=http://edge.dev.box.sk]edge.dev.box.sk[/URL] the download link is [URL=http://edge.dev.box.sk/download/daily/]http://edge.dev.box.sk/download/daily/[/URL] if you have any trouble installing it just ask me and i will be happy to help?

iv seen another type of bloging system if im correct i think its called blog ability which iv seen at [URL=http://fsforum.50free.org/blog/]http://fsforum.50free.org/blog/[/URL]
Copy linkTweet thisAlerts:
@MstrBobMay 22.2004 — Considering that your blog entries are different types of data, they should be in different tables. However, and don't think you need to create a new table for each blog entry, seeing as how, unless you write very, very long entries, your index information for the table will occupy more space than your data, not good space managment. I would suggest having two tables, one for entries, the other for comments. Simply tie the comments to the correct blog entries and you should be fine. That's all IMHO.
Copy linkTweet thisAlerts:
@Paul_JrMay 23.2004 — I'm with MstrBob on this one. I created a sort of a "shell" blog a while ago, for the experience, and that's what I did. I had two tables (three, actually; one for login); entries, and comments. I had an auto incrementing ID that I inserted with each blog entry, and that's how I associated the comments with each entry. Every time a comment was made, the ID of the blog entry was inserted along with it.
Copy linkTweet thisAlerts:
@Daniel_TMay 23.2004 — I have 1 database to manage my blog stuff, in which I have 2 tables. One table is for the entries, and one for the comments. In each row of the entries table, there is a field named "ID", which is a number, unique for each entry. Then, in the comments table, there is a field named "EntryID", in which it stores the number of the entry that comment is for. As far as management, I just use phpMyAdmin to add in the entries as of right now. However, I did, at one point, write a script to manage it when I was using flat files, rather than a database. This structure is what seems to work best for me. However, each entry in my Entries database contains HTML for inserting images and breaks and stuff. I'm workin a script now so I won't have to include HTML when writing an entry.
Copy linkTweet thisAlerts:
@ConorMay 23.2004 — I have two tables. One of the tables stores comments and the other table stores all of my blog entries. With each comment I insert all the info you see in the fields + ip and a field called replyto which stores the entry # that the comment is replying to. When selecting the comments I select where the ID of the entry equals the reply to and them loop them out so yeah like you were thinking about doing I have two tables.
Copy linkTweet thisAlerts:
@deraMay 23.2004 — [i]Originally posted by MstrBob [/i]

[B]Considering that your blog entries are different types of data, they should be in different tables. However, and don't think you need to create a new table for each blog entry, seeing as how, unless you write very, very long entries, your index information for the table will occupy more space than your data, not good space managment. I would suggest having two tables, one for entries, the other for comments. Simply tie the comments to the correct blog entries and you should be fine. That's all IMHO. [/B][/QUOTE]


do you think my website is to long?
Copy linkTweet thisAlerts:
@MstrBobMay 23.2004 — [i]Originally posted by dera [/i]

[B]do you think my website is to long? [/B][/QUOTE]


What? I'm rather confused... What I'm saying is, unless you have a really, really long post, the Indexing information is larger than the data. Having a lot of entries isn't a problem, and its a more efficient use of space to use one table for all entries.
Copy linkTweet thisAlerts:
@deraMay 23.2004 — okai, but d you think i should have less posts displaying on my site?
Copy linkTweet thisAlerts:
@spufiMay 23.2004 — Since I'll be starting up my own blog project here in the near future, I have currently 5 tables, and I'll probably add two more. Why so many? I have the basic user table, post table, and comment table, but I'm also using a table for the menu, categories of the post I make so people can look through the archive in a little more structured manor, and images. There is some other stuff I'm going to add in too that will require tables. So, while my blog database is bigger, the blog will be able to do some more things with those tables. Since I've alreay used a blogging tool and looked at others, I think I have a decent idea of what I want to do with mine before I ever begin coding for it.
Copy linkTweet thisAlerts:
@pyroMay 23.2004 — My blog uses 9 tables. One of these days I'll have time to get it to a public beta, and you'll be able to [i]see[/i] what I did. ?
Copy linkTweet thisAlerts:
@SamauthorMay 23.2004 — Thanks for all the responses guys, Pyro, I'm not sure how you pulled off 9 tables, but I'm interested to find out, make sure to post here or on ryanbrill.com when you release it, as I check each regularly.
Copy linkTweet thisAlerts:
@spufiMay 23.2004 — I just want to add that Word Press v1.0(my current blog tool) uses 12 tables and I haven't checked to see how many are used in v1.2.
Copy linkTweet thisAlerts:
@SamauthorMay 24.2004 — Really? If you don't mind my asking, what do info do they store?
Copy linkTweet thisAlerts:
@MstrBobMay 24.2004 — In reality, you could have as many tables as you really want. Two tables being the bare minimum, ideally. Some bloggers use 3 tables, one for entries, one for comments, and one to store users (Author and commentors). One blog script in particular that I saw, created a new table after every 30 entries, why for, I'm not really sure. Considering the server must sift through all of the entries anyway, creating new, identical indexes is rather pointless. There are, of course, extra feautures that one could add, such as polls and a guestbook of sorts if you wanted. I guess it all really depends on what you want.
Copy linkTweet thisAlerts:
@spufiMay 24.2004 — [i]Originally posted by Sam [/i]

[B]Really? If you don't mind my asking, what do info do they store? [/B][/QUOTE]


I haven't even begun to weed through all of the stuff it does so I can't really say. Some of it I know I won't use, but it's there for other people who would. http://wordpress.org/ It's a free blogging tool, so you can download it and play around with it. Just playing around with it has helped me a ton in trying layout what I want in a blogging tool I will try to make.
×

Success!

Help @Sam spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...