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 paragraph    Short paragraph    Short paragraph
of text under      of text under      of text under
the image.         the image.         the image.

+-----------+      +-----------+      +-----------+
|  image 4  |      |  image 5  |      |  image 6  |
+-----------+      +-----------+      +-----------+

Short paragraph    Short paragraph    Short 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 -0000
> 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 <tr><td><?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

Reply via email to