Jump to content


Photo

Creating a blog with PHP/MySQL


  • Please log in to reply
6 replies to this topic

#1 Gerbilkit

Gerbilkit
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 30 May 2006 - 09:59 PM

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\" /]



#2 homchz

homchz
  • Members
  • PipPipPip
  • Advanced Member
  • 93 posts
  • LocationLee, New Hampshire

Posted 30 May 2006 - 10:20 PM

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


#3 Gerbilkit

Gerbilkit
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 30 May 2006 - 10:35 PM

Well I guess images aren't essential 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\" /]

#4 homchz

homchz
  • Members
  • PipPipPip
  • Advanced Member
  • 93 posts
  • LocationLee, New Hampshire

Posted 30 May 2006 - 10:50 PM

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.



#5 Gerbilkit

Gerbilkit
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 30 May 2006 - 10:57 PM

[!--quoteo(post=378531:date=May 30 2006, 05:50 PM:name=homchz)--][div class=\'quotetop\']QUOTE(homchz @ May 30 2006, 05:50 PM) View Post[/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\" /]

#6 homchz

homchz
  • Members
  • PipPipPip
  • Advanced Member
  • 93 posts
  • LocationLee, New Hampshire

Posted 30 May 2006 - 11:10 PM

[!--quoteo(post=378534:date=May 30 2006, 06:57 PM:name=Gerbilkit)--][div class=\'quotetop\']QUOTE(Gerbilkit @ May 30 2006, 06:57 PM) View Post[/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.

#7 Gerbilkit

Gerbilkit
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 30 May 2006 - 11:13 PM

[!--quoteo(post=378535:date=May 30 2006, 06:10 PM:name=homchz)--][div class=\'quotetop\']QUOTE(homchz @ May 30 2006, 06:10 PM) View Post[/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\" /]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users