[PHP-DB] Best way to store/retrieve content??
I'm writing some content management scripts for an online magazine. Many articles are formatted in a similar way, but some have a unique page layout that includes grids of photos, tables, etc. I'm not sure if the best way to store content is in a database so it can be flowed into an article template, or to simply lay out the page as HTML, surrounding it with a simple include(header.php) and include(footer.php) for header/footer HTML and graphics. For articles that require things like tables, it would be a pain to have to write this HTML by hand or lay it out in Dreamweaver then copy and past the code into the database field (using an Admin web form). Or, is it prudent to set up a custom table in the databse for each type of content so that a matching template can be used to format the pages properly without having to include all the HTML in the database with the content itself? Hope this makes some sense. Just trying to figure out the best way to tackle this. All input is appreciated! Monty -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Best way to store/retrieve content??
Could you use PDFs? -Natalie -Original Message- From: Monty [SMTP:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 2:31 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Best way to store/retrieve content?? I'm writing some content management scripts for an online magazine. Many articles are formatted in a similar way, but some have a unique page layout that includes grids of photos, tables, etc. I'm not sure if the best way to store content is in a database so it can be flowed into an article template, or to simply lay out the page as HTML, surrounding it with a simple include(header.php) and include(footer.php) for header/footer HTML and graphics. For articles that require things like tables, it would be a pain to have to write this HTML by hand or lay it out in Dreamweaver then copy and past the code into the database field (using an Admin web form). Or, is it prudent to set up a custom table in the databse for each type of content so that a matching template can be used to format the pages properly without having to include all the HTML in the database with the content itself? Hope this makes some sense. Just trying to figure out the best way to tackle this. All input is appreciated! Monty -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Best way to store/retrieve content??
I would try to use CSS, instead of complex tables. That way, you only need to store the structural html in the database and the layout is handled by CSS--floating images and flowing text are really easy with CSS. -Original Message- From: Monty [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 11:31 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Best way to store/retrieve content?? I'm writing some content management scripts for an online magazine. Many articles are formatted in a similar way, but some have a unique page layout that includes grids of photos, tables, etc. I'm not sure if the best way to store content is in a database so it can be flowed into an article template, or to simply lay out the page as HTML, surrounding it with a simple include(header.php) and include(footer.php) for header/footer HTML and graphics. For articles that require things like tables, it would be a pain to have to write this HTML by hand or lay it out in Dreamweaver then copy and past the code into the database field (using an Admin web form). Or, is it prudent to set up a custom table in the databse for each type of content so that a matching template can be used to format the pages properly without having to include all the HTML in the database with the content itself? Hope this makes some sense. Just trying to figure out the best way to tackle this. All input is appreciated! Monty -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Best way to store/retrieve content??
I will be using CSS for other thing, such as paragraph formatting, but, not sure how to use it for creating tables and flowing text around graphics. Can CSS really do all that? Still not sure if this will work because I don't want the writers to have to type in any HMTL code at all if possible. Here's a good example: One article may be a simple interview with some images (this is easy to enter into a database). But another article about new beauty products has a grid of images plus a short blurb about each product next to the photo. This requires more intricate formatting with HTML than an interview does. I don't have a problem creating separate templates for these special types of articles, but, it looks like I'd also have to set up separate database tables to store this article data differently than it would be stored for a simple interview. But, it would be better if all content was centrally stored in one table to make searches better/easier...or am I expecting too much from just one content table? What to do, what to do! From: [EMAIL PROTECTED] (Court Shrock) Newsgroups: php.db Date: Thu, 7 Mar 2002 11:31:20 -0800 To: 'Monty' [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP-DB] Best way to store/retrieve content?? I would try to use CSS, instead of complex tables. That way, you only need to store the structural html in the database and the layout is handled by CSS--floating images and flowing text are really easy with CSS. -Original Message- From: Monty [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 11:31 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Best way to store/retrieve content?? I'm writing some content management scripts for an online magazine. Many articles are formatted in a similar way, but some have a unique page layout that includes grids of photos, tables, etc. I'm not sure if the best way to store content is in a database so it can be flowed into an article template, or to simply lay out the page as HTML, surrounding it with a simple include(header.php) and include(footer.php) for header/footer HTML and graphics. For articles that require things like tables, it would be a pain to have to write this HTML by hand or lay it out in Dreamweaver then copy and past the code into the database field (using an Admin web form). Or, is it prudent to set up a custom table in the databse for each type of content so that a matching template can be used to format the pages properly without having to include all the HTML in the database with the content itself? Hope this makes some sense. Just trying to figure out the best way to tackle this. All input is appreciated! Monty -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Best way to store/retrieve content??
Hi Natalie, no, PDFs won't work. I need to display the content as an HTML page. From: [EMAIL PROTECTED] (Natalie Leotta) Newsgroups: php.db Date: Thu, 7 Mar 2002 14:32:57 -0500 To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Best way to store/retrieve content?? Could you use PDFs? -Natalie -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Best way to store/retrieve content??
In theory, if your writers are using a word processor such as Word you could try just saving as HTML and seeing if that works. I doubt they'd appreciate it if you asked them to write in FrontPage, but that would give you what you need too. If these ideas don't work you may want to browse other magazines online (if you go to fashion ones then they should have the tables you talked about). You could try magazines like Cosmo, Seventeen, etc. and see if you can get any feel for what they are developing in. I only came up with the PDFs because one site I go to uses them and we use them for some of our web publications for the NCI. Good luck! -Natalie -Original Message- From: Monty [SMTP:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 2:46 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Best way to store/retrieve content?? Hi Natalie, no, PDFs won't work. I need to display the content as an HTML page. From: [EMAIL PROTECTED] (Natalie Leotta) Newsgroups: php.db Date: Thu, 7 Mar 2002 14:32:57 -0500 To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Best way to store/retrieve content?? Could you use PDFs? -Natalie -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Best way to store/retrieve content??
Hi I have done a similar thing, and found that you can store just the text in the database. I added 'Short_content' which was a leader, and some other fields for management. I designed a few templates in Dreamweaver and embeded a function to display the content in the page eg trtd?php print_content($ContentID) ?/td/tr The function basically pulls the content from the database and prints it. You can just print the text, or you can add HTML in the function to give a particular layout. You can use the same principal to link images, or you can hard code them into the page. If you want to be more sophisticated you can use a number of templates and store the one to use in the record, giving. display.php?contentID=1234 -query db to get template for 'Article 1234' -output 'template_1.htm' which has the correct layout, and the function for this article embedded in it CREATE TABLE S_content ( ContentID int(11) NOT NULL auto_increment, Title varchar(100) NOT NULL default '', Description varchar(250) default NULL, Short_content text, Full_content text, UserID int(11) default NULL, Start_date date default NULL, End_date date default NULL, End_actionID int(11) NOT NULL default '0', Template_file varchar(50) , PRIMARY KEY (ContentID), KEY ContentID(ContentID), ) HTH Peter --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- -Original Message- From: Monty [mailto:[EMAIL PROTECTED]] Sent: 07 March 2002 19:31 To: [EMAIL PROTECTED] Subject: [PHP-DB] Best way to store/retrieve content?? I'm writing some content management scripts for an online magazine. Many articles are formatted in a similar way, but some have a unique page layout that includes grids of photos, tables, etc. I'm not sure if the best way to store content is in a database so it can be flowed into an article template, or to simply lay out the page as HTML, surrounding it with a simple include(header.php) and include(footer.php) for header/footer HTML and graphics. For articles that require things like tables, it would be a pain to have to write this HTML by hand or lay it out in Dreamweaver then copy and past the code into the database field (using an Admin web form). Or, is it prudent to set up a custom table in the databse for each type of content so that a matching template can be used to format the pages properly without having to include all the HTML in the database with the content itself? Hope this makes some sense. Just trying to figure out the best way to tackle this. All input is appreciated! Monty -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Best way to store/retrieve content??
Actually, CSS is very powerful--way more than simple html. One drawback is that CSS1 did not include any support for tables directly, but the generic controls work nicely, there just is no way to say table align=center in CSS1. A great book that taught me a lot about CSS is http://www.oreilly.com/catalog/css/ --I'd lone it to you if you were local. I think it would be feasible to store all content in one db: just use your templates to convert the articles to appropriate markup and then store the results. (I am departing from html) The interview: [input_form] Template: selectInterview/select Question: input value=How are you doing? Answer: input value=Fine, thanks for asking [form_submittal] $content = _header($template); foreach (question) { $content .= p class='question'span class='us'Us:/span$question/p p class='answer'span class='them'Them:/span$answer/p; } insertArticle($content); The beauty product: [input_form] Template: selectpicture/select Picture: input file=pic1.jpg Description: textareaJust imagine yourself all prettied up like this glorious person/textarea Transition: textareaAnd now that brings us to some really cool whale-inard products/textarea Picture: input file=pic2.jpg Description: textareaWe promise that no animals were harmed during the making./textarea [form_submittal] $content = _header($template); foreach(picture) { $content .= p class='picture'img class='pic$count' src='$file'$description/p; if ($transition != '') $content .= p class='$transition_count'$transition/p; } ...anyway, you get the idea.this is a rather simple approach--but, you could combine something like this with an output template to get really good results. -Original Message- From: Monty [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 11:46 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Best way to store/retrieve content?? I will be using CSS for other thing, such as paragraph formatting, but, not sure how to use it for creating tables and flowing text around graphics. Can CSS really do all that? Still not sure if this will work because I don't want the writers to have to type in any HMTL code at all if possible. Here's a good example: One article may be a simple interview with some images (this is easy to enter into a database). But another article about new beauty products has a grid of images plus a short blurb about each product next to the photo. This requires more intricate formatting with HTML than an interview does. I don't have a problem creating separate templates for these special types of articles, but, it looks like I'd also have to set up separate database tables to store this article data differently than it would be stored for a simple interview. But, it would be better if all content was centrally stored in one table to make searches better/easier...or am I expecting too much from just one content table? What to do, what to do! From: [EMAIL PROTECTED] (Court Shrock) Newsgroups: php.db Date: Thu, 7 Mar 2002 11:31:20 -0800 To: 'Monty' [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP-DB] Best way to store/retrieve content?? I would try to use CSS, instead of complex tables. That way, you only need to store the structural html in the database and the layout is handled by CSS--floating images and flowing text are really easy with CSS. -Original Message- From: Monty [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 11:31 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Best way to store/retrieve content?? I'm writing some content management scripts for an online magazine. Many articles are formatted in a similar way, but some have a unique page layout that includes grids of photos, tables, etc. I'm not sure if the best way to store content is in a database so it can be flowed into an article template, or to simply lay out the page as HTML, surrounding it with a simple include(header.php) and include(footer.php) for header/footer HTML and graphics. For articles that require things like tables, it would be a pain to have to write this HTML by hand or lay it out in Dreamweaver then copy and past the code into the database field (using an Admin web form). Or, is it prudent to set up a custom table in the databse for each type of content so that a matching template can be used to format the pages properly without having to include all the HTML in the database with the content itself? Hope this makes some sense. Just trying to figure out the best way to tackle this. All input is appreciated! Monty -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http
Re: [PHP-DB] Best way to store/retrieve content??
Hi Peter, thanks a lot for your advice. I think where I'm stuck is how to best store certain types of articles in a data table. Interviews would be easy, because it's just paragraphs of text with an inline photo here and there. The more structured articles are trickier and I can't figure out how to use the same Article table for all articles. Using the example I gave in a previous message, here's a rough page layout of one of these structured articles: +---+ +---+ +---+ | image 1 | | image 2 | | image 3 | +---+ +---+ +---+ Short paragraphShort paragraphShort paragraph of text under of text under of text under the image. the image. the image. +---+ +---+ +---+ | image 4 | | image 5 | | image 6 | +---+ +---+ +---+ Short paragraphShort paragraphShort paragraph of text under of text under of text under the image. the image. the image. If I have one field in the Article table for full_content (which works just fine for interviews), how could I enter the above type of article into this table so that the template will know to separate each element text block and match it up with the associated image? Is this a matter of writing a special parsing function that would take the following from the full_content field... img src=image1.jpg Short paragraph of text under the image. img src=image2.jpg Short paragraph of text under the image. ...and format break it down into an array so it can then be formatted on the page as illustrated above? My real block is how the set up the database more than the templates. As I mentioned, I'm trying to keep all articles in one data table so searches can be easily done on all articles. Thanks! Monty From: [EMAIL PROTECTED] (Peter Lovatt) Newsgroups: php.db Date: Thu, 7 Mar 2002 20:11:00 - To: Monty [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP-DB] Best way to store/retrieve content?? Hi I have done a similar thing, and found that you can store just the text in the database. I added 'Short_content' which was a leader, and some other fields for management. I designed a few templates in Dreamweaver and embeded a function to display the content in the page eg trtd?php print_content($ContentID) ?/td/tr The function basically pulls the content from the database and prints it. You can just print the text, or you can add HTML in the function to give a particular layout. You can use the same principal to link images, or you can hard code them into the page. If you want to be more sophisticated you can use a number of templates and store the one to use in the record, giving. display.php?contentID=1234 -query db to get template for 'Article 1234' -output 'template_1.htm' which has the correct layout, and the function for this article embedded in it CREATE TABLE S_content ( ContentID int(11) NOT NULL auto_increment, Title varchar(100) NOT NULL default '', Description varchar(250) default NULL, Short_content text, Full_content text, UserID int(11) default NULL, Start_date date default NULL, End_date date default NULL, End_actionID int(11) NOT NULL default '0', Template_file varchar(50) , PRIMARY KEY (ContentID), KEY ContentID(ContentID), ) HTH Peter --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Best way to store/retrieve content??
Hi Court, thanks a lot for your advice. I am fairly new to PHP, so, I'm a little slow in understanding some of the suggestions in your detailed post. From what I gather, you suggested that an Admin script be created to basically build each portion of an article piece by piece, which would then be combined and stored in a single field in the Articles data table. Is that right? The only thing I can see being a problem with this method is if the writer needs to go back and edit the article. Unless I strip out all HTML and parse the sections out into individual fields, they would have to contend with all the HTML code written into the article content field. I'd like to reduce the amount of HTML stored with the article content in the database as much as possible so that writers don't have to worry about anything but the most basic codes. Here's one idea I have. In the database field, the article content may look something like this: [START-BLOCK] [IMG=photos/image1.jpg] This product will make your skin feel silky smooth. [END-BLOCK] [START-BLOCK] [IMG=photos/image2.jpg] New from Nivea, a lotion that moisturizes and protects from the sun. [END-BLOCK] ...which I can then parse to lay the article out like this... +---+ +---+ +---+ | image 1 | | image 2 | | image 3 | +---+ +---+ +---+ Short paragraphShort paragraphShort paragraph of text under of text under of text under the image. the image. the image. +---+ +---+ +---+ | image 4 | | image 5 | | image 6 | +---+ +---+ +---+ Short paragraphShort paragraphShort paragraph of text under of text under of text under the image. the image. the image. If this is a doable and good way to go, then my next question is, which PHP string function would be the best to use for parsing custom codes (like [IMG=) into actual HTML codes? Thanks! Monty From: [EMAIL PROTECTED] (Court Shrock) Newsgroups: php.db Date: Thu, 7 Mar 2002 12:16:07 -0800 To: 'Monty' [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP-DB] Best way to store/retrieve content?? Actually, CSS is very powerful--way more than simple html. One drawback is that CSS1 did not include any support for tables directly, but the generic controls work nicely, there just is no way to say table align=center in CSS1. A great book that taught me a lot about CSS is http://www.oreilly.com/catalog/css/ --I'd lone it to you if you were local. I think it would be feasible to store all content in one db: just use your templates to convert the articles to appropriate markup and then store the results. (I am departing from html) The interview: [input_form] Template: selectInterview/select Question: input value=How are you doing? Answer: input value=Fine, thanks for asking [form_submittal] $content = _header($template); foreach (question) { $content .= p class='question'span class='us'Us:/span$question/p p class='answer'span class='them'Them:/span$answer/p; } insertArticle($content); The beauty product: [input_form] Template: selectpicture/select Picture: input file=pic1.jpg Description: textareaJust imagine yourself all prettied up like this glorious person/textarea Transition: textareaAnd now that brings us to some really cool whale-inard products/textarea Picture: input file=pic2.jpg Description: textareaWe promise that no animals were harmed during the making./textarea [form_submittal] $content = _header($template); foreach(picture) { $content .= p class='picture'img class='pic$count' src='$file'$description/p; if ($transition != '') $content .= p class='$transition_count'$transition/p; } ...anyway, you get the idea.this is a rather simple approach--but, you could combine something like this with an output template to get really good results. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Best way to store/retrieve content??
Valid point--I was thinking that in a news article or such, the content is mostly already created and edited, just needed to be posted by someone not familar with HTML. I like your idea about the [start-stop block]. To maybe merge what Paul said with your idea, you could store the name of the function handler (generates the appropriate content) inside the []. [renderProducts] [renderImage] /photos/image1.jpg [/renderImage] [renderDescription] This product will make your skin feel silky smooth. [/renderDescription] [renderImage] /photos/image2.jpg [/renderImage] [renderDescription] New from Nivea, a lotion that moisturizes and protects from the sun. [/renderDescription] that way, the main handler (renderProducts) is always at the top. The main handler would then strip out the data/sub-routine calls (renderImage, renderDescription) and pass that data to the function along with a context variable like $op or something so that the same functions could be used to display to the screen and to edit the results thanks to $op (add/modify/view, etc...). The function renderImage could contain an internal counter to when to display the next row. Creating this source data would require something similar to my last post, except replacing the html with the appropriate []. Of course, what we are really doing is xml. Maybe should just do xml: renderProducts product image /photos/image1.jpg /image description This product will make your skin feel silky smooth. /description /product product image /photos/image2.jpg /image description New from Nivea, a lotion that moisturizes and protects from the sun. /description /product /renderInterview In parsing the first example, I would probably use preg_match and regular expressions. In parsing the xml, I would use php's xml parser. Hope this helps a little more-- Court -Original Message- From: Monty [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 1:04 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Best way to store/retrieve content?? Hi Court, thanks a lot for your advice. I am fairly new to PHP, so, I'm a little slow in understanding some of the suggestions in your detailed post. From what I gather, you suggested that an Admin script be created to basically build each portion of an article piece by piece, which would then be combined and stored in a single field in the Articles data table. Is that right? The only thing I can see being a problem with this method is if the writer needs to go back and edit the article. Unless I strip out all HTML and parse the sections out into individual fields, they would have to contend with all the HTML code written into the article content field. I'd like to reduce the amount of HTML stored with the article content in the database as much as possible so that writers don't have to worry about anything but the most basic codes. Here's one idea I have. In the database field, the article content may look something like this: [START-BLOCK] [IMG=photos/image1.jpg] This product will make your skin feel silky smooth. [END-BLOCK] [START-BLOCK] [IMG=photos/image2.jpg] New from Nivea, a lotion that moisturizes and protects from the sun. [END-BLOCK] ...which I can then parse to lay the article out like this... +---+ +---+ +---+ | image 1 | | image 2 | | image 3 | +---+ +---+ +---+ Short paragraphShort paragraphShort paragraph of text under of text under of text under the image. the image. the image. +---+ +---+ +---+ | image 4 | | image 5 | | image 6 | +---+ +---+ +---+ Short paragraphShort paragraphShort paragraph of text under of text under of text under the image. the image. the image. If this is a doable and good way to go, then my next question is, which PHP string function would be the best to use for parsing custom codes (like [IMG=) into actual HTML codes? Thanks! Monty From: [EMAIL PROTECTED] (Court Shrock) Newsgroups: php.db Date: Thu, 7 Mar 2002 12:16:07 -0800 To: 'Monty' [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP-DB] Best way to store/retrieve content?? Actually, CSS is very powerful--way more than simple html. One drawback is that CSS1 did not include any support for tables directly, but the generic controls work nicely, there just is no way to say table align=center in CSS1. A great book that taught me a lot about CSS is http://www.oreilly.com/catalog/css/ --I'd lone it to you if you were local. I think it would be feasible to store all content in one db: just use your templates to convert the articles to appropriate markup and then store the results
RE: [PHP-DB] Best way to store/retrieve content??
I like your idea about the [start-stop block]. To maybe merge what Paul said with your idea, you could store the name of the function handler (generates the appropriate content) inside the []. I meant Peter :) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Best way to store/retrieve content??
Hi I am not an expert but could XML be an answer? The author(s) gets a screen designed by you, looking like the screen you will publish, with type in text boxes (name=short_text1, name=short_text2 etc )where the text will be. When you store the input from the form you end up with article pic1pic1.jpg/pic1 short_text1Short paragraph of text under pic1 /short_text pic2pic2.jpg/pic2 short_text2Short paragraph of text under pic2/short_text2 long_textlots of stuff, lots of stuff, lots of stuff, lots of stuff, lots of stuff, /long_text /article which allows you to add any structure to the data, but store all the article in a single searchable text field. Otherwise maybe you could use two tables. CREATE TABLE Article ( ArticleID int(11), Title char(50), Start_date date default NULL, End_date date default NULL, End_actionID int(11) NOT NULL default '0', Template_file varchar(50) , ) CREATE TABLE Article_components ( ArticleID int(11), Component_name char(50), Content text ) Article_components might contain :- +--+++ |ArticleID | Component_name | Content| +--+++ |123 | pic1 | pic1.jpg | +--+++ |123 | short_text1| Short text etc etc | +--+++ |123 | pic2 | pic2.jpg | +--+++ |123 | short_text2| Short text etc etc | +--+++ Which you could search and return the articleID, which you could then use to retive the article in full. To display, loop thro the result trtd$row[pic1]/tdtd$row[pic2]/tdtd$row[pic3]/td/tr trtd$row[short_text1]/tdtd$row[short_text2]/tdtd$row[short_ text3]/td/tr Just a few thoughts Be interested to know how you do this in the end. Peter --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- -Original Message- From: Monty [mailto:[EMAIL PROTECTED]] Sent: 07 March 2002 20:51 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Best way to store/retrieve content?? Hi Peter, thanks a lot for your advice. I think where I'm stuck is how to best store certain types of articles in a data table. Interviews would be easy, because it's just paragraphs of text with an inline photo here and there. The more structured articles are trickier and I can't figure out how to use the same Article table for all articles. Using the example I gave in a previous message, here's a rough page layout of one of these structured articles: +---+ +---+ +---+ | image 1 | | image 2 | | image 3 | +---+ +---+ +---+ Short paragraphShort paragraphShort paragraph of text under of text under of text under the image. the image. the image. +---+ +---+ +---+ | image 4 | | image 5 | | image 6 | +---+ +---+ +---+ Short paragraphShort paragraphShort paragraph of text under of text under of text under the image. the image. the image. If I have one field in the Article table for full_content (which works just fine for interviews), how could I enter the above type of article into this table so that the template will know to separate each element text block and match it up with the associated image? Is this a matter of writing a special parsing function that would take the following from the full_content field... img src=image1.jpg Short paragraph of text under the image. img src=image2.jpg Short paragraph of text under the image. ...and format break it down into an array so it can then be formatted on the page as illustrated above? My real block is how the set up the database more than the templates. As I mentioned, I'm trying to keep all articles in one data table so searches can be easily done on all articles. Thanks! Monty From: [EMAIL PROTECTED] (Peter Lovatt) Newsgroups: php.db Date: Thu, 7 Mar 2002 20:11:00 - To: Monty [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP-DB] Best way to store/retrieve content?? Hi I have done a similar thing, and found that you can store just the text in the database. I added 'Short_content' which was a leader, and some other fields for management. I designed a few templates in Dreamweaver and embeded a function to display the content in the page eg trtd