Re: Data architecture question
| From: | Michael Stearne | Date: | Wed, 13 Dec 2000 17:18:59 +0000 |
| Subject: | Re: Data architecture question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-30109@lists.php.net to get a copy of this message | ||
On Wednesday, December 13, 2000, at 11:38 AM, Ashley T. Howes PhD wrote:
> This is not a specific PHP question, but more a data architecture
> query. However I guess several of you have considered this more than
> once.
>
> In developing a news site with many articles on it, what is best
> practise for storing and administering the content? A specific
> problem I have been examining is that each database field can store
> only a finite number of characters. If the body of an article is
> larger than this, what is the best approach for storage?
Most databases shouldn't have any problem storing a story that is even several pages, in mySQL
the field type is TEXT. You could store the story is an external file, but I am more inclined to
store the text of the file in the database. This was you can still separate content from the layout
of your site but having all the text of all the stories in one database might prove to be easier to
administer.
> solution might be to save the content in a text file with a unique
> filename on the hd - but this must lead to slow queries as the data
> is external to the db.
>
If you do go with external files, I don't think this will be very slow, what might be slow is
the large query results that are returned from the database field that may contain a story with
10,000 words. This is the case where you can get into making static HTML pages from one query of
the database, to save the load on the database.
> What about specifying formatting of the content? Is the best
> approach to place formatting tags in the copy which are interrupted
> on the fly? How about images associated with the copy, should these
> be saved to unique filename on hd, or is there a better approach?
The administration sites that I have created and seen have had the journalist insert some basic HTML
themselves if necessary like <B> <I> <A HREF>, etc. Coming up with you own
shorthand HTML language and then parser might be overkill and a waste of your time. They can always
use a WYSIWYG tool like Dreamweaver to do their story and then paste in the HTML source.
The graphic images for the story should be stored in the filesystem and referenced to in the
database. Like: image1='story378383image1.jpg' which when printed in the script will look
like: <IMG SRC="/where/my/images/are/<?echo $r->image1?>">
Michael