Guest Posted July 28, 2003 Posted July 28, 2003 When i would like to accost a person in czech language, i need to declesion his name. For example if his name is Vaclav i need to display welcome message "Welcome back Vaclave". So I need to define some sort of table, where is the name in nominative and then the same name in 5. case. In the welcome message then will be the Welcome back "Vaclav" filled by the 5. case from the table ... it means Welcome back "Vaclave". Is there anything like this convert table? Thank you
Guest Posted July 28, 2003 Posted July 28, 2003 are there different rules for each case? if it is the same ending depending on which case and/or male or female it might be easier to just use a function. such as function output_czech_name( $name, $gender, $case ) { switch ($case) { case NOMINATIVE: if ($gender =='Male') { return $name . MALE_NOMINATIVE_DECLENSION; } else { return $name . FEMALE_NOMINATIVE_DECLENSION; } case ACCUSATIVE: { etc ..... } }
Guest Posted July 29, 2003 Posted July 29, 2003 are there different rules for each case? if it is the same ending depending on which case and/or male or female it might be easier to just use a function. [/code] It is a problem. Each name has special ending ... there isn't same ending for male of fema. I think I will need something like conversion table. The conversion table should looke like this: Michal, Michale Lenka, Lenko Borivoj, Borivoji Oskar, Oskare The first name is the name that the customer fill in register form. The second is the word to be used in e-mails, welcome messages etc. I'am not good in PHP programming, so if anyone should send me this (I think easy) script, please reply.
Guest Posted July 29, 2003 Posted July 29, 2003 Make a database table called name2name. CREATE TABLE `name2name` ( `name2name_id` INT( 11 ) NOT NULL AUTO_INCREMENT , `nominative` VARCHAR( 32 ) NOT NULL , `name` VARCHAR( 32 ) , PRIMARY KEY ( `name2name_id` ) ); During login, in login.php, add $name2name_query = tep_db_query("select name from " . TABLE_NAME2NAME . " where nominative='" . $customer_first_name . "'"); $name2name = tep_db_fetch_array($name2name_query); $customer_name = $name2name['name']; tep_session_register('customer_name'); around line 49. In my login.php, that is where the tep_session_register commands start. You also have to update tep_customer_greeting (in includes/functions/general.php), so that it uses customer_name instead of customer_first_name. Likewise wherever else you want to use that version. As always, no testing has been done on this code. Use at your own risk. Hth, Matt
Guest Posted July 29, 2003 Posted July 29, 2003 I have done what you has written, mSQL table is created successfully, then I modified the login.php and general.php script. In mSQL tabla i have manually entered nominative "Michal" and name "Michale". When the user with name "Michal" would like to login, this error appears: 1146 - Table 'mobilkryt.TABLE_NAME2NAME' doesn't exist select name from TABLE_NAME2NAME where nominative='Michal' [TEP STOP] Any idea where the mistake can be? Thank you
Guest Posted July 30, 2003 Posted July 30, 2003 You need to add define('TABLE_NAME2NAME', 'name2name'); to the includes/database_tables.php (if it exists) or includes/application_top.php (if not). Good luck, Matt
Guest Posted July 30, 2003 Posted July 30, 2003 Thank you very much ... it is working ... but there is still one problem. When the customers name is in the convert table, then everything is OK. But when the customers name is not in the table, nothing appears. Is it posible to display the original customers name if there is no entry for his name in the convert table? And thank you very much again
Guest Posted July 30, 2003 Posted July 30, 2003 Try changing this: $name2name = tep_db_fetch_array($name2name_query); $customer_name = $name2name['name']; to this: if ($name2name = tep_db_fetch_array($name2name_query)) { $customer_name = $name2name['name']; } else { $customer_name = $customer_first_name; } Make sure that you do this *after* $customer_first_name is defined. Order wasn't important before this, but now is. Good luck, Matt
Guest Posted July 30, 2003 Posted July 30, 2003 Thank you very much ... now it is working really perfect :D
Recommended Posts
Archived
This topic is now archived and is closed to further replies.