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

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.


->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) ,

  KEY ContentID(ContentID),



Excellence in internet and open source software
tel. 0121-242-1473

> -----Original Message-----
> From: Monty [mailto:[EMAIL PROTECTED]]
> Sent: 07 March 2002 19:31
> 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

Reply via email to