views:

57

answers:

2

Hi,

I'm creating a blog in asp.net mvc for learning purpose so please no answers telling me i should use an open source blogengine. I need to understand how is the blog content going to work. So i have a table called "Blog" with a column called "Content". The "Content" will hold the blog i.e. text and images etc. Now i have the following questions:

  1. What should be the datatype of content.
  2. Is this the correct way of doing it i.e. saving the blog in a record.
  3. What are the contants of this blog i.e. is it html with rich text and image urls and how does it actually work, i.e. where are these image urls be pointing to and how will my application render it.

Thanks.

+2  A: 

Though you certainly could make it work with a single table, you probably want to use several tables to store the content. A basic implementation might look like:

  • One table for the periodical list of blog entries you have with columns for blog ID, perma-link/url, etc
  • One table for the tags associated with each blog id
  • One table for the blog entries themselves, consisting of a blog ID, blog body, etc
  • One table for comments, with blog ID, comment ID, comment body, etc

Everything would be linked together in the tables by the various IDs (blog ID, comment ID, etc) and your engine would load and render the body elements as specified by the ID requested.

Images, attachments, etc would be stored on a fileserver, and the rendered content would have hyperlinks to them.

This is by far a simplistic envisioning of it, and doesnt cover many aspects or issues. For instance, if you plan to store content such as images, etc in your DB you will need to have unique pointers for those, tables for those items and a way to resolve them as part of your MVC framework.

Start simple, and build up from there if you are just learning. Just build each table as you need it and go from there.

GrayWizardx
Thanks for your reply. I've already got all these tables.I guess my question is specific to the "Blogs" table here and specifically the Content record.So from what i understand the Content record will have html in there containing both text and image urls.<p> This is my blog content> </p><img url="../img/abc.jpg" />1. How will i be able to check if the rendered html of the blog content will look on in my page.2. Will i have some sort of text area that will be populated by this blog content.3. Should i be using some external editor for writing blogs like "Windows Live Writer".
Khurram
To use Windows Live Writer with your blog, you have to implement an XML-RPC interface called the Metaweblog API. This can be quite complicated, so, here's a link to the spec: http://www.xmlrpc.com/metaWeblogApi
hatkirby
@khurram, if this is purely for your own learning I am not sure how I would answer other than "it depends". HTML preview is not *strictly* a requirement of a blog, but if you were going to do it there are plenty of free controls out there to display HTML, or you could have a three step "Post, Review, Submit" process where the person writes their markup, submits it, the server displays it for them and they approve it. Most blog engines are more sophisticated but that would work. As for the editor you use thats a design decision for you.
GrayWizardx
A: 

Not sure which DB you are using but assume SQL server for this example. You can store your blog content in a field as nvarchar(MAX). i dont see any issues with doing this

ooo