--- Tedit kap <[EMAIL PROTECTED]> wrote:

> Lets say I am creating a database table with coulmns like in below for a news
> portal website:
>  
> story title 
> first paragraph
> second paragraph
> third paragraph
> ...
> ...
> contact info
>  
> I would want the title display in some format and paragraphs in another
> format and the contact info another etc...
>  
> My question is: 
>  
> If lets say there needs to be a list item in between two paragraphs (but this
> wont be the case always), can I insert that list within the paragraph text in
> the database within the paragraph such as
> <ul>
> <li>...</li>
> <li>...</li>
> </ul>
> , and it will display as a list in the website? Or do I need to have a
> seperate column in the table for a listed item? But the location and size of
> list item (if any) will be different for each article. So I thought I should
> not make a column for listed items, but insert in one of the paragraph
> columns. So the question is will it display correctly and how can I do that?
>  
> How about inserting a picture to the article (again, only some articles will
> have a pic), should I have a seperate column for picture (display location
> can be fixed) so that column will be blank for an article with no picture,
> but it will pull up the picture if there is any. Is my thinking right?
>  
> Thanks
>  
> Matt


In general, you can store HTML in a large text field in MySQL (such as datatype
"text" for up to 64k of data).  When you retrieve and use a PHP function like
print to display it, the HTML tags will be presented as well.  This would
include image tags and unordered lists.  

The image src value will need to be an absolute URL pointing to the image or
relative to your PHP script.  If it is relative to a location on another
server, it won't work.

If you are trying to control the visual appearance of the paragraphs then you
will want to look to Cascading Style Sheets (CSS) and place your content in one
or more <div> containers.  There are other groups for CSS tricks and tweaks.

The striptags() function has additonal parameters to allow you to be selective
about which tags to allow.  http://php.net/striptags  This could be helpful but
may not erase all formatting from other sources.

James

Reply via email to