Now learn Yii as well as trying to do the tasks on it.
There was a problem creating a multilingual website. There is one problem that I do not know how to solve. Namely CRUD actions on multilingual content.
So there are two tables for each type of content.
In one (in my case the page) table includes general information and settings.
In another (page_content) has fields with translations. In this table, a unique key for two fields
page_id, lang_code
Table: Page
CREATE TABLE IF NOT EXISTS `geega_main_db`.`page` (
`page_id` INT NOT NULL AUTO_INCREMENT COMMENT 'Page ID' ,
`page_status` TINYINT NOT NULL DEFAULT 0 COMMENT '\nstatus of page (publish/hide) 0-hide, 1-publish, 2-draft' ,
`page_teim_create` INT NOT NULL COMMENT 'time page create' ,
`page_time_status_upd` INT NOT NULL COMMENT 'time status update' ,
PRIMARY KEY (`page_id`) )
ENGINE = InnoDB
Table: Page_content
CREATE TABLE IF NOT EXISTS `geega_main_db`.`page_content` (
`page_id` INT NOT NULL COMMENT 'page id ' ,
`lang_code` ENUM('ua','ru','en') NOT NULL COMMENT 'language code' ,
`pc_url_name` VARCHAR(128) NULL ,
`pc_meta_title` VARCHAR(255) NOT NULL COMMENT 'Meta title ' ,
`pc_meta_keys` VARCHAR(255) NULL COMMENT 'Meta keywords' ,
`pc_meta_desc` TEXT NULL COMMENT 'Meta description' ,
`pc_title` VARCHAR(255) NULL COMMENT 'Page title' ,
`pc_content` TEXT NOT NULL COMMENT 'Page content' ,
UNIQUE INDEX `un_ind` (`page_id` ASC, `lang_code` ASC) ,
CONSTRAINT `page_id_fk`
FOREIGN KEY (`page_id` )
REFERENCES `geega_main_db`.`page` (`page_id` )
ON DELETE CASCADE
ON UPDATE CASCADE)
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_unicode_ci
In the specification for the task you want to implement to create and edit multi-language content in the form of tabs.
So, there will be several tabs.
Each tab corresponds to a specific language. Each tabe will have the same set of fields
Here is an example of design
4508
I also need to keep the ability to easily add a language.
While I have no clue how to properly implement a course other than manually creating all the form fields
But I wanted to use CActiveForm.
Can I use it as the standard features of Yii?
Perhaps you can make editing and creating content which is another convenient way.
I would be grateful advice.
Can someone help?
P.S Sorry for my english