SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast bilbo--baggins's Avatar
    Join Date
    Nov 2006
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Designing a database to allow store variable page layouts

    My site is currently made up of static pages, with product description pages that follow a similar theme, but are all different to a degree. I'm moving the site over to Coldfusion, and planning to use it with mySQL.

    Currently product pages contain a mixture of paragraphs, ordered and unordered lists, in a variable order. From my limited knowledge of SQL so far, I was thinking that I could have one table that refers to components of the page stored in other tables. For example, the first item might be a paragraph, stored in a paragraphs table, then there might be a list, and all items of that list are in a list table, then another paragraph etc.

    I remember learning basic programming years ago, and started to design my own sort routine, and started by having it look at the first character of each word, and working through sequentially. I later discovered that there was no need, you could simply ask if one word was bigger than another word, in it's entirety.

    Similarly, I'm wondering if there is a simpler way of storing a product description in a database. The people editing the product descriptions are not familiar with HTML, so I didn't want to simply have description with HTML formatting in the database.

    I'm just in the design phase at the moment, the first time I've used a relational database or Coldfusion, but I have read the mySQL Crash Course book by Ben Forta, and am working my way through the CFWACK books, but (so far no example quite fits what I'm trying to do).

    Thanks for any help, any tips would be useful.
    Last edited by bilbo--baggins; Mar 11, 2008 at 07:02.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,274
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by bilbo--baggins View Post
    The people editing the product descriptions are not familiar with HTML, so I didn't want to simply have description with HTML formatting in the database.
    so, don't show them the html

    one way is to have customized tables for every possible html scenario

    nested OL inside the LI of a UL? that'd be a separate table

    BLOCKQUOTE between Ps? separate table

    inline IMG versus floating IMG? maybe same table, but how to you indicate where it goes inline?

    see where this is headed? over-engineered, complicated, sql hell

    alternatively, use a browser-based html editor

    i've tried a couple for myself (ektron and minicms, i think), but since i know html, i never kept any...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast bilbo--baggins's Avatar
    Join Date
    Nov 2006
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, thanks, that's useful.

    Would it be normal practice to store the html in a database, or just have an html document for each product (eg. with a reference in the database to the correct html document, and inserted by the CF template)? I don't want to discover I've chosen something that's going to make it harder to manage in future (or going to require a re-design).

  4. #4
    SitePoint Enthusiast bilbo--baggins's Avatar
    Join Date
    Nov 2006
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Are product descriptions usually stored in databases?

    I'm converting a static site to a Coldfusion site, and trying to work out the design of the mySQL database.

    Is it normal to put the product description (with HTML formatting?) in a database table, or would it be better to have a link to an html file within the CF template?

    I had initially thought I'd need multiple tables for storing lists, paragraphs, etc. but a reply I got in the SQL forum suggested that would make it overly complicated.

    My guess is that it would be easier to manage if the description (with html formatting) was included in a table - and if so - would it be normal to keep it all as one large chunk of html or would it be necessary to break it down into pieces (like my original plan of having tables for lists, paragraphs etc).

    [ Looks like the moderators merged this separate thread from the Coldfusion forum - just to explain why it looks like I'm repeating myself here... ]
    Last edited by bilbo--baggins; Mar 12, 2008 at 09:35.

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,274
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    yes, it is common to store the html

    it is also common to store the plain text as well, so that you can use the plain text for searching, but show the html on the results page
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  6. #6
    SitePoint Zealot YAHA's Avatar
    Join Date
    Jan 2008
    Location
    MD, US
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not sure about common standards for this but I store entire html contents of my site's pages in MySQL database. If you use type LONGTEXT, it will have plenty of space for the largest possible html code. This way also has an edge if, later on, you need to organize search.

  7. #7
    SitePoint Evangelist asprookie's Avatar
    Join Date
    May 2005
    Posts
    539
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Been asking myself the same question, anyway I don't see any way other than the br or p tag to separate lines and paragraph for product description. Is there?

  8. #8
    SitePoint Enthusiast
    Join Date
    Mar 2008
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,
    You may also find this article interesting:
    /* DATABASE DRIVEN TEMPLATE ENGINE */
    http://www.mished.co.uk/showthread.php?t=12


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •