Jump to content

Creating a blog with PHP/MySQL


Gerbilkit

Recommended Posts

Well I am trying to code a dynamic blog application from the ground up. I am not that good at PHP/ MySQL. But I know enough to keep going. What I am totall confused on now is how you display the blog articles? Right now all I have is a query that brings out a single variable 'varchar' into one long article. Unfortunately this adds little flexibility. How do users add images, text formatting, paragraphs, headings, etc. Do I have to try some bbcode style editer where they must hope they got all their tags right? Is it normally even done with database variables? Or should the users be able to create html files.

Also wouldn't it be dangerous to let users add files? As I would use an include statement and I think that makes it part of the script therefore making me susceptible to SQL injection hacks. [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]

All the friends I have asked who have more experience merely urged me to download wordpress, and assured me I was going about it too complicated. But I still want to try it on my own. So anyone who has the time I would greatly appreciate some help. [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

Link to comment
Share on other sites

I am building my own blog at this point too, and it is a long process. Sure you can build one fast, with just a few queries and forms, but the key is to find all the options you want then code them in.

My suggestion would be to use a Wordpress or other blog to find out what you want then, create your plan.

I am three weeks into mine and only about 10% done. Granted I only get to code on the evenings.

This is a big undertaking for someone with limited knowledge, but I will give you some info.

Database tables I have so far are

Topics
Posts
Comments
Categories
Users

When i want a full post I grab the Topic (Header) from the Topic Table joined to the Post table where I get the body of the post. Then it searches for any comments, and displays them appropriatley.

I am archiving by category and date to start with, but will allow multiple topics for one Post so it need to beable to relate the Topic to many categories.

I would not allow anyone to upload anything other than text, giving the public too much power when they do not need it is not a good idea, and if you have limited skills to code PHP, you will not be successful in fending off problems.

I hope this helped some, good luck,

Josh
Link to comment
Share on other sites

Well I guess images aren't [i]essential[/i] but they would be nice. The more flexibility they have a higher quality application it is. Of course then again all images would have to be approved by me in the first place. ;)

I tried downloading wordpress but there were so many files I had trouble even knowing where to start looking. I wasn't too interested in the myraid of extra features. [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]

But the users must at least have the flexibility to create some basic text formatting, paragraphs, and headers and whatnot. I guess I'll go ahead and dig out some bbcode tutorials. Can't seem to find a better idea. *sigh*

So I guess I can take heart that I am trying something worthwhile. Either that or hit myself for being insane... [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /]
Link to comment
Share on other sites

If you create a db table with a text or blob, then use the nl2br() function it will insert line breaks for every return, and if you use regular html codes like <b> </b> they will work instead of needing bbcode.

Link to comment
Share on other sites

[!--quoteo(post=378531:date=May 30 2006, 05:50 PM:name=homchz)--][div class=\'quotetop\']QUOTE(homchz @ May 30 2006, 05:50 PM) [snapback]378531[/snapback][/div][div class=\'quotemain\'][!--quotec--]
If you create a db table with a text or blob, then use the nl2br() function it will insert line breaks for every return, and if you use regular html codes like <b> </b> they will work instead of needing bbcode.
[/quote]
But I though letting users use HTML was dangerous. [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /]
Link to comment
Share on other sites

[!--quoteo(post=378534:date=May 30 2006, 06:57 PM:name=Gerbilkit)--][div class=\'quotetop\']QUOTE(Gerbilkit @ May 30 2006, 06:57 PM) [snapback]378534[/snapback][/div][div class=\'quotemain\'][!--quotec--]
But I though letting users use HTML was dangerous. [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /]
[/quote]

It can be but you should be able to limit what they can and cannot use.
Link to comment
Share on other sites

[!--quoteo(post=378535:date=May 30 2006, 06:10 PM:name=homchz)--][div class=\'quotetop\']QUOTE(homchz @ May 30 2006, 06:10 PM) [snapback]378535[/snapback][/div][div class=\'quotemain\'][!--quotec--]
It can be but you should be able to limit what they can and cannot use.
[/quote]
I thought that was the purpose of bbcode. [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.