I'm writing my own Blog using PHP and MySQL. I would like to know the
best way to store each blog entry. I was thinking of 1 of 3 ways. Any
ideas or thoughts on which is the most efficient would be helpful.
1. As text, then let PHP load the text file, parse it and render the page.
2. As a PHP page, that way, I could just load the PHP file.
3. In a MySQL table. Load it using a PHP script. Is this slower?
And should I store the user responses in the same way?
Ideally I would like the final page to be static with the blog entry and
all of its responses. But I don't want to have to go through a big
mess to remove an entry or have to redo the page if I change page
layout/formats in the future.
Is there any _preferrable_ method to do this? Any thoughts would be helpful?
Please be as technical as you can. Thanks.
--
John
----------------------------
Remove 'NOSPAM' to email me.
Blog = Web log
I thought everyone was familiar with the term by now.
At home? What does that mean?
Are you serious? In the past few year "blogging" has become quite a
popular thing on the web. Type 'blog' into google and see for yourself.
You say that it is short for web log. What is a web log? Which aspect of the
web is it logging?
Sounds like more geek-speak to me.
Tony Marston
"KIPAX" <ma...@kipax.com> wrote in message
news:1bt24vkiug9f34uus...@4ax.com...
> On Wed, 05 Feb 2003 15:27:13 -0500, John
> <skepticNO...@yahoo.com> wrote:
>
>
> >> By now? Well I have been developing on the web for ten years.. If I
> >> heard it before then it was once and forgettable :)
> >
> >Are you serious? In the past few year "blogging" has become quite a
> >popular thing on the web. Type 'blog' into google and see for yourself.
>
> See now no one else is going to admit to not knowing the term... but i
> bet there are others out there :)
It could be personal diary that the user is keeping on the web in order to
bore other people, or political commentary, or just about anything.
--
Alan Walkington
Technical Staff
United Defense, San Jose
"Tony Marston" <to...@NOSPAM.demon.co.uk> wrote in message
news:b1rv58$h5r$1$8300...@news.demon.co.uk...
(please don't top post)
30 years? I guess it is something for the younger generations. I have no
idea why you think it has anything to do with IT. And the fact that you
have not heard the term in no way invalidates it or renders it as
"geek-speak".
Web logs are "logging" individual events by people who would like to
place this information to the public. Things like 'phpnuke' and 'xoops'
can be used for such purpose of blogging or if you want something better
you can try 'blogger', 'movabletype' or 'radio userland'.
Suggestion to you: look it up on google and see its popularity.
<snip>
(please don't top post)
You have a very narrow minded view on the topic. You're right in that it
can be just about anything but the goal is *public* viewing of things.
The web is all about freedom to access information.
To stay relevant, these are some useful blogs I've found:
http://www.phpblog.com/blog/
http://php-princess.net/
http://php.weblogs.com/
"Sort of a private message board for egotistical geeks who think their
opinions are of overwhelming interest to others." ???????
Well I guess I should place some value on your opinion. Right?
Hardly, it's in the English Dictionary these days; that's how wide-spread
they are.
I think the preferred way of doing this is MySQL. I've been building a CMS
using XML files in a flat-filing system recently. The differences in terms
of performance between the two are neglible. I prefer XML since I find it
easier to transform into many different formats (the main blog page, an RSS
feed, a WAP version, etc).
Think more about what you want to do with the data (in a very specific way)
and use that. As long as your code has no major bottlenecks, efficiency is
going to be high any way you choose.
Thanks.
I plan to put some more thought on it, as I intend to make my code as
extensible and flexible as possible. I never even considered XML.
That would be faster than using a database.
> 2. As a PHP page, that way, I could just load the PHP file.
How do you intend to create your entries?
> 3. In a MySQL table. Load it using a PHP script. Is this slower?
Yes, it's slower than the filesystem, but more flexible and easier
to maintain, to search, to modify, etc.
>
> And should I store the user responses in the same way?
If you want them to be the same type of object as your own entries, you
do. If you aren't sure, make them the same type of object. I mean 'object'
in the most general sense of the word, not necessarily OOP classes...
> Is there any _preferrable_ method to do this? Any thoughts would be helpful?
No, it's open for creativity.
I think this is the way to go for me. XML as an option seems to be
useful here.
>>2. As a PHP page, that way, I could just load the PHP file.
>
>
> How do you intend to create your entries?
Not sure. Good point. I was somehow thinking that a static page would be
the best. And I could write some methods to edit that page.
>>3. In a MySQL table. Load it using a PHP script. Is this slower?
>
>
> Yes, it's slower than the filesystem, but more flexible and easier
> to maintain, to search, to modify, etc.
Well I think I should store with the file system and save some (perhaps
redundant) data in the DB for the purpose of indexing and searching.
>>And should I store the user responses in the same way?
>
>
> If you want them to be the same type of object as your own entries, you
> do. If you aren't sure, make them the same type of object. I mean 'object'
> in the most general sense of the word, not necessarily OOP classes...
I guess it makes most sense to keep them in the exact same type.
>>Is there any _preferrable_ method to do this? Any thoughts would be helpful?
>
>
> No, it's open for creativity.
Thanks.
There are a lot of people writing blogs and I think they add value to sites
with forums as a further extension of creating communities on a site. It
also falls under the "stickiness" umbrella.
You can also use a blog as a way of disseminating corporate information as
it's little more than a rapidly updated list of news items. For a personal
blog the value of these 'Dear Diary...' type entries may or may not be
significant. For a business they could be beneficial and engender the
feeling that your organisation is doing something every day and takes its
web presence seriously, rather than just a corporate brochure.
There are some people with very successful blogs and they're making money
from effectively producing an online magazine, even with ISSNs. A blog is
more for non-geeks than geeks. The value of "Dear Diary, just wrote 24,700
lines of Perl but got bogged down by a really complex RegEx" has little
value to most people.
Paulus
I intend to add blogging abilities to some of my sites too as a natural
enhancement to lively discussion forums. It builds the membership and keeps
them coming back. I also like the community appeal of blogs and that it can
make life easier for a hard pressed person online when they have 208 people
on their AOL Buddy List but not enough time to keep up-to-date.
I haven't researched the market yet but I'd be interested in SourceForge
first for any other projects that could be used or enhanced.
However, from scratch, I'd use MySQL to store the entries and replies. I'd
also store the entries in HTML so that you can query and dump the data
without having to parse [b] to <b> or any other formatting options you may
give your users. A blogwide search facility is then easily achieved and you
don't have to write cumbersome file manipulation routines to remove
comments. Any blog is going to be defaced as there are a lot of morons out
there. I run a large celebrity fan site with 1.5M page views per month and
defacing attempts occur a few times per week. Everything I write these days
has some moderation/editing ability in it.
If you don't store anything in the entries/responses that are design
specific, i.e. colour or font face changes you shouldn't have a problem
changing the design. I use this approach on similar features that store text
in MySQL tables. Only <b>, <i>, <img> and <a> tags are allowed.
I doubt that a blog is going to put a substantial strain on a server. If it
did, you could add a cacheing function to the code.
Paulus
On Wed, 05 Feb 2003 19:39:51 -0500, John
<skepticNO...@yahoo.com> wrote:
>>>1. As text, then let PHP load the text file, parse it and render the page.
>>
>>
>> That would be faster than using a database.
>
>I think this is the way to go for me. XML as an option seems to be
>useful here.
>
---
Rob Tweed
M/Gateway Developments Ltd
Global DOMination with eXtc : http://www.mgateway.tzo.com
---
Huh? XML is a database system? Is it relational? Is there a query
language? Are the two options mutually exclusive, or wouldn't you
be using MySQL to store information, and use XML to present it?
> However, from scratch, I'd use MySQL to store the entries and replies. I'd
> also store the entries in HTML so that you can query and dump the data
> without having to parse [b] to <b> or any other formatting options you may
> give your users. A blogwide search facility is then easily achieved and you
> don't have to write cumbersome file manipulation routines to remove
> comments.
A minor problem to consider when storing as HTML is in searching. While
it would be trivial to add a search capability to allow users to search
entries for "something about this or that", the search would see the
HTML tags, and "something about <b>this</b> or that" would not match.
I'm haven't thought of any elegant solution to this. There wouldn't
be a problem if plain text were stored, but being able to recall
entries -in format- is just too important to leave out. It would
be nice if MySQL had a striptags() function like PHP has. PHP's
striptags() function is not an option, since it's MySQL that's
doing the selecting...
Microsoft Professionals(tm) might tell you to store the formatted
text in one field, and the unformatted text for searching in
another... yeah, right.
Again, I don't have a quick and clean answer to this problem, which
is why I'm posting it, 'cause maybe somebody else can share...
On 6 Feb 2003 11:15:48 -0800, gl...@potatoradio.f2s.com (Razzbar)
wrote:
---
I personally don't have a BLOG myself, but I read a lot of them..
Especially in the Flash Development communities.. Web Blogs are huge!
Basically, It's a online journal or sorts. A large amount of blogs are
created using XML feeds, and are picked up for syndication even!!
Take a look!
http://radio.weblogs.com/
-Richard
> Oh My Gaud.. Seriously? 30 years in the IT business, and you don't know
> what a Blog is?? Wow.. Dude.
>
> I personally don't have a BLOG myself, but I read a lot of them..
> Especially in the Flash Development communities.. Web Blogs are huge!
>
> Basically, It's a online journal or sorts. A large amount of blogs are
> created using XML feeds, and are picked up for syndication even!!
>
> Take a look!
> http://radio.weblogs.com/
>
> -Richard
Resistance is futile .. you will be cited and cataloged .. ;-)
----------------------------------
Fast automatic Paradox/Delphi table repair at a click of a mouse!
http://www.sundialservices.com/products/chimneysweep
I have also heard of bulletin boards, which I used briefly, but they have
been replaced by newsgroups.
I don't use Flash, and I hate web sites that do.
I know and love XML. In fact I am currently building a demo website with PHP
that uses XML/XSL to create all HTML output.
As for web logs, or "blogs" in geek-speak, I have absolutely no interest in
them.
Tony Marston
"Richard Ragon" <bse...@hanaho.com> wrote in message
news:3E47729C...@hanaho.com...
Everybody is entitled to their own opinion. Some things are useful while
others are useless. I like using Apache, PHP, MySQL and XML. I have no use
for Flash animations or web logs. I prefer newsgroups to online forums. To
each his own.
> I don't see much difference in blogging and what you do you on your
> "Uniface Stuff" web page. Sometimes terms can be redundant.
I would not describe the contents of my web site as a "web log" or any kind
of log. The dictionary definition of a "log" is "any detailed record of
events". My web site does not record events, it is merely information about
the Uniface development language. No-one can put information there except
me.
Exactly what is the difference between a web log, a newsgroup and a bulletin
board? If there is no difference then why invent a new name? Especially one
that misuses an existing term.
Tony Marston
They're completely different. A newsgroups and buleltin boards are a
threaded-tree type series of discussions on a particular subject undertaken
by many people, weblogs are not. They are usually run by a single person who
wants to talk about anything (no particular subject): their life, their
thoughts on technology, their writing, links to other websites, cool stuff
etc. ANYTHING.
"vKp" <ass...@hotmail.com> wrote in message
news:b2c0lk$pqd$1...@newsg2.svr.pol.co.uk...
> Exactly what is the difference between a web log, a newsgroup and a bulletin
> board? If there is no difference then why invent a new name? Especially one
> that misuses an existing term.
This is a newsgroup. A Usenet newsgroup. Messages are passed from server
to server using NNTP protocol. Even though I'm reading this with a http
brower, this message will travel across the internet (which is not the
same thing as the "web") using a specific protocol, and the message will
have a header in a specific format.
Usenet newsgroups can be -exactly- defined. When I hear 'bulletin board'
I think of a site you connect to via phone lines, not the internet, where
there are files for download, announcements, maybe games, chat, forums,
etc... Dinosaurs today. There were many different programs that people
used to establish bulletin boards, and many different programs people
used to connect to them. But not as exact a definition as Usenet, and
I can definitely see how a website could have the look and feel of a
'traditional' bulletin board.
Blogs are an evolving phenomenon, and about the only thing they all
have in common is they -tend- to be personal journals ('logs').
Why invent a new name? Hey, a new thing deserves a new name!
Oh, what fun!
Your reasoning and assumption are illogical.
I thought it was clear that the answer is NO.
It is part of the www now. Get over it.
As I said, they are for nerds and anoraks and people who wear bobble hats.
Thier hobbies probably include train spottingor collecting matchbox tops.
Tony Marston
"John" <skepticNO...@yahoo.com> wrote in message
news:3E49AF8A...@yahoo.com...
Tony Marston
"Razzbar" <gl...@potatoradio.f2s.com> wrote in message
news:c48470fc.03021...@posting.google.com...
I never stated that everyone *should* know about it. I assumed those who
work with PHP would know about it. Look at my original post. I only
asked for advice.
I only pursued this, because of your immature attitude and how you being
"IT for over 30 years" somehow makes you some sort of authority. First
you said it was "geek speak" which was disproved when it was stated it
is already in dictionaries. Then you make foolish assertions about
"anoraks". Which is also untrue. Additionally it is not used by a small
minority, as many popular websites are shifting to this style of web
content. Most likely you have seen many such websites but did not
realize the style of content. You can claim otherwise but it is highly
unlikely.
Your _assumption_ that blogs are useless just shows how little you know
about the current World Wide Web.
> As I said, they are for nerds and anoraks and people who wear bobble hats.
> Thier hobbies probably include train spottingor collecting matchbox tops.
WTF is a matchbox top?
In all my years in web authoring I've never heard of such a thing.
As someone with a self-proclaimed ignorance and disinterest in weblogs
you seem to have a very strong opinion about them.
--
Richard Watson
http://www.opencolo.com/
Colocation Colocation Colocation
Can you please tell me how the ramblings of an individual constitute an
important contribution to the world wide web?
"John" <skepticNO...@yahoo.com> wrote in message
news:3E4A95FE...@yahoo.com...
> I never stated that everyone *should* know about it. I assumed those who
> work with PHP would know about it.
Why did you make that assumption? What is the connection between PHP and web
logs? Why should knowledge of one automatically infer knowledge of the
other?
> Additionally it is not used by a small
> minority, as many popular websites are shifting to this style of web
> content. Most likely you have seen many such websites but did not
> realize the style of content. You can claim otherwise but it is highly
> unlikely.
You are confusing me. Is a web log so called because of its content or its
style? Why should established web sites want to change their format to
emulate the ramblings of an individual?
> Your _assumption_ that blogs are useless just shows how little you know
> about the current World Wide Web.
I've been surfing the web since the mid 90s and I've never come across the
term, so it can't be that important.
The part of a matchbox that contains the brand name. People used to collect
them and display them in albums, because of their pretty colours. Just like
stamp collectors.
> In all my years in web authoring I've never heard of such a thing.
Similarly in all my years of web browsing I've never heard of web logs.
> As someone with a self-proclaimed ignorance and disinterest in weblogs
> you seem to have a very strong opinion about them.
Only because it was inferred that by not knowing about web logs I was
missing out on the best thing since sliced bread. I found some on a Google
search and all I can say is "why bother?"
Why do you call them ramblings? They are *many* useful blogs out there.
For example PHP:
http://www.phpblog.com/blog/
http://php-princess.net/
http://php.weblogs.com/
Just because 1 person writes them it does not mean he/she is more or
less important. And also it says nothing about the quality of content.
>>I never stated that everyone *should* know about it. I assumed those who
>>work with PHP would know about it.
>
>
> Why did you make that assumption? What is the connection between PHP and web
> logs? Why should knowledge of one automatically infer knowledge of the
> other?
Many blogging tools rely on some type of content delivery and scripting
tools to make posting easier. An ideal tool would be PHP. There are many
content management systems (ex: xoops and phpnuke) that are built on
PHP. Lastly, the term has become so popular that my assumption was fair.
>
>>Additionally it is not used by a small
>>minority, as many popular websites are shifting to this style of web
>>content. Most likely you have seen many such websites but did not
>>realize the style of content. You can claim otherwise but it is highly
>>unlikely.
>
>
> You are confusing me. Is a web log so called because of its content or its
> style? Why should established web sites want to change their format to
> emulate the ramblings of an individual?
Why do you call them ramblings? No one necessarily *changes* their site.
If you read the previous posts, content is irrelevant. Blogging has no
particular style per se. One recent use has been for
maintaining/updating News on a particular subject.
The site: http://mozillazine.org which provided news on Mozilla
development uses blogging to provide latest up to date information.
>>Your _assumption_ that blogs are useless just shows how little you know
>>about the current World Wide Web.
>
>
> I've been surfing the web since the mid 90s and I've never come across the
> term, so it can't be that important.
I cannot possibly know how much of what type of sites that *you* surf.
If you deem that with your IT experience it is unimportant to *you*,
then that is your opinion which is irrelevant to me. But to assert from
*your* surfing, that it is unimportant in general, is a flawed and naive
argument.
I hope you are not loosing sleep over this. Get over it.
> Only because it was inferred that by not knowing about web logs I was
> missing out on the best thing since sliced bread. I found some on a Google
> search and all I can say is "why bother?"
Are you sure you're not confusing web logs with web sites ;-)
Seriously though, its just a tool, and like every tool it has good and
bad instances of its use. Move on.
--
Richard Watson
http://www.opencolo.com/
High Quality, Value for money colocation
May I suggest you take your argument to alt.flame instead?
C.L.P is for the discussion of PHP, not for your personal arguments. Your
energies would be far better served responding to questions from newbies,
rather than trying to prove to the world at large who has the bigger ego.
Regards,
David
--
David Jonathan Grant
http://www.davidjonathangrant.info/
Sure, I will not persue this any further.
Well..., no. Blogging has even been reported on in mainstream media.
> and from your
> description they are something used by a small minority of people and serve
> no useful purpose.
That's a remarkably provincial viewpoint, i.e. everyone is entitled to
their own opinion, no matter how misguided it might be.
YOU may have no use for a blog, (neither do I, for that matter), but
there are lots of people and organizations that have found them to be
extremely effective tools.
One person defined a "web log" as a type of web site, and another says it is
a tool for building web sites. I'm still none the wiser, but I shall shut up
and end this useless thread.
Tony Marston
"John" <skepticNO...@yahoo.com> wrote in message
news:3E4BBFEF...@yahoo.com...
From: http://www.blogger.com/about.pyra
<copy>
What is a weblog/blog?
A blog is a web page made up of usually short, frequently updated posts
that are arranged chronologically—like a what's new page or a journal.
The content and purposes of blogs varies greatly—from links and
commentary about other web sites, to news about a company/person/idea,
to diaries, photos, poetry, mini-essays, project updates, even fiction.
Blog posts are like instant messages to the web.
Many blogs are personal, "what's on my mind" type musings. Others are
collaborative efforts based on a specific topic or area of mutual
interest. Some blogs are for play. Some are for work. Some are both.
Blogs are also excellent team/department/company/family communication
tools. They help small groups communicate in a way that is simpler and
easier to follow than email or discussion forums. Use a private blog on
an intranet to allow team members to post related links, files, quotes,
or commentary. Set up a family blog where relatives can share personal
news. A blog can help keep everyone in the loop, promote cohesiveness
and group culture, and provide an informal "voice" of a project or
department to outsiders.
</copy>
That's a very arrogant and discriminating attitude. Here is a popular
blog from Stanford Law Professor Lawrence Lessig
http://cyberlaw.stanford.edu/lessig/blog/
Another law blog: http://www.lawblog.com/
Search for more on your own.
Just because you don't know something doesn't mean everybody else must
be an idiot.
The fact that you have found a blog site that interests you is your good
fortune.
Tony Marston
"AlwaysGoodTimes" <a...@mindless.com> wrote in message
news:g6Y2a.544$B77.56...@newssvr15.news.prodigy.com...
It also rather nicely points up your lack of knowledge and understanding
about the term "blog", the associated technology, and the uses to which
it has been placed.
Indeed, Dr. Lessig clearly doesn't belong in the group "...nerds and
anoraks and people who wear bobble hats...".
Why not just admit that the whole phenomenon just slipped by you while,
you were aging, and that your subsequent attempt to dismiss it as
insignificant was based on poor research?
Tony Marston
"Neb Revod" <spam...@biteme.com> wrote in message
news:MPG.18b6e2975...@pdx.news.speakeasy.net...
Rather lame comparison.
Can't do it, can you?
Here's a good starting page for blogs.
I found alot of interesting stuff here.
http://boingboing.net/blogosphere.html
If you look at the home page on boingboing.net, it says google just
bought blogger.
that ought to tell you something. Google is one company that appears to
know what it is doing.
red
I've had to tackle this problem as well, and there could be some possible
solutions to searching. One way is to have the PHP search function break up
the search string into an array:
$SearchArray = explode(" ", $SearchString);
Then you could use a for loop to search for each word individually using SQL
"like" and retrieving an indexed ID field, then push that into another ID
for later retrieval:
$IndexesArray = array();
for ($i = 0; $i < count($SearchArray); $i++)
{
$Sql = "select id from entries where text like '%" . $SearchArray[$i] .
"%'";
$Query = @mysql_query($Sql);
$Results = @mysql_num_rows($Query);
if ($Results > 0)
{
$id = @mysql_fetch_row($Query);
array_push($IndexesArray, $id);
}
}
Now you'll have an array, $IndexesArray, which holds all the id's of the
blog entries which match one or more of the words in the search string. Of
course, it gets much more complicated if you want to do boolean type
searches, allowing users to enter words such as "or" and "and", but that can
be done as well. This will get around any HTML in the blogs because you are
using the like and '%' in the SQL statement. I could see this becoming a
significant server load, however, as the number of blog entries increases
and such. However, I have used this method on very large commercial sites
to search through 1000's of pages of content and have only noticed a 3-5
second wait, 7-10 during peak times. That's not all that bad.
Any other ways of doing this?
- Dave
> Then you could use a for loop to search for each word individually using SQL
> "like" and retrieving an indexed ID field, then push that into another ID
> for later retrieval:
>
> $IndexesArray = array();
>
> for ($i = 0; $i < count($SearchArray); $i++)
> {
> $Sql = "select id from entries where text like '%" .
$SearchArray[$i] .
> "%'";
why not use only one SQL Statement ?
$sql = "
select id
from entries
where text like '%".implode("%' OR text LIKE '%",$SearchArray).
"%'
";
HTH
Christoph
>Can you please tell me how the ramblings of an individual constitute an
>important contribution to the world wide web?
In essence, blogging is so important a contribution to the WWW and the
world at large that the Chinese government has taken enormous steps to
block TENS OF THOUSANDS OF BLOGS from being viewed by its own people.
Amazing too considering, as the article suggests, over 95% of the
users of the DynaWeb service are from China.
When you look at a different perspective of blogging, as in Chinese
people trying to inform the rest of the world about the things going
on behind "The Great Firewall of China" then you realize that blogs
are not just "ramblings" but can also represent pleas for help.
Oh yeah, and trying to keep within topic - virtually 100% of the
Chinese blogs are created using PHP running on Apache servers. :)