Hi,
I am a newbie for CakePHP.
Working on a multilingual E-commerce website.
Except the basic learning curve there is problem regarding finding
multilingual content based on current selected language and site base
language.
I have tables as follows for languages, countries,
country_translations respectively:
CREATE TABLE IF NOT EXISTS `languages` (
`code` char(2) NOT NULL,
`site_admin_id` tinyint(3) unsigned NOT NULL,
`base` enum('y','n') NOT NULL default 'n',
`disabled` enum('y','n') NOT NULL default 'n',
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`code`),
KEY `site_admin_id` (`site_admin_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Languages supported by
site';
CREATE TABLE IF NOT EXISTS `countries` (
`iso2` char(2) NOT NULL,
`site_admin_id` tinyint(3) unsigned NOT NULL,
`disabled` enum('y','n') NOT NULL default 'n',
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`iso2`),
KEY `site_admin_id` (`site_admin_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Countries supported by
Axygen website';
CREATE TABLE IF NOT EXISTS `country_translations` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`site_admin_id` tinyint(3) unsigned NOT NULL,
`country_iso2` char(2) NOT NULL,
`language_code` char(2) NOT NULL,
`name` varchar(64) NOT NULL,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `site_admin_id` (`site_admin_id`),
KEY `language_code` (`language_code`),
KEY `country_iso2` (`country_iso2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Countries''
translations including base language' AUTO_INCREMENT=488 ;
Here I want to fetch country translations to show in registration
form. The requirement is to fetch translation for selected language
[assume FR - French] if available or for the default language [assume
EN- English].
then further to show the country iso as values in SELECT input of form
and Country translations as Options.
I have tried as below:
In Controller:
$states = $this->User->State->find('list');
$countries = $this->User->Country->find('list');
$countrytranslations=$this->User->Country->CountryTranslation->find
('list');
$this->set(compact('states',
'countries','countrytranslations'));
In View Template
echo $form->input('country',array('options'=>
$countrytranslations));
But it didn't worked.
Please help me!
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---