Pretty new to db ussage. BUT......... Information is potentiel energy. I am building a site where forms, headers, footer, pages... ect are treated as objects and the values of the forms can be pulled from the db.
There are two approches.
First Approche
- I have a site_page table the table is below
and if query is to find a form with a particular pageid I can also
find out what language form values it has which means the formid has a language_id.
so the formid has the following
attributes
formid
form_name
form_language
form_values
description
This table will have alot of redundence becuse only the form_language will change.
+-----------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+------------------+------+-----+---------+----------------+
|pageid | int(10) unsigned | | PRI | NULL | auto_increment |
| pageid | int(10) unsigned | YES | | NULL | |
| page_name | varchar(60) | YES | | NULL | |
| page_url | varchar(80) | YES | | NULL | |
| created | date | YES | | NULL | |
| last_modified | date | YES | | NULL | |
| header | enum('N','Y') | YES | | NULL | |
| footer | enum('N','Y') | YES | | NULL | |
| flash | enum('N','Y') | YES | | NULL | |
| form | enum('N','Y') | YES | | NULL | |
| image | enum('N','Y') | YES | | NULL | |
| sound | enum('N','Y') | YES | | NULL | |
| ftp | enum('N','Y') | YES | | NULL | |
| chat_room | enum('N','Y') | YES | | NULL | |
| video | enum('N','Y') | YES | | NULL | |
| bullentin_board | enum('N','Y') | YES | | NULL | |
| description | blob | YES | | NULL | |
+-----------------+------------------+------+-----+---------+-----
2nd Approche
have a site_page idex like the one below
and then have tables {Language}site_page, {Language}form_object. An example would be Spanish_site_page, Spanish_form_object ect........
+-------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------------+------+-----+---------+----------------+
| pageid | int(10) unsigned | | PRI | NULL | auto_increment |
| site_name | varchar(30) | YES | | NULL | |
| page_name | varchar(60) | YES | | NULL | |
| designed_by | varchar(30) | YES | | NULL | |
| created | date | YES | | NULL | |
| modified | date | YES | | NULL | |
| description | blob | YES | | NULL | |
+-------------+------------------+------+-----+---------+----------------+
The first approche appeals to me but I am worried about access speed. If I understand a little bit more about index according to language access time problems are minimized. Any suggestions? How would you build a site which has the same template but the language changes?
Thanks
Thomas