CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.

YesSoftware Forums -> CodeCharge Studio -> PHP

 Programmically change tables used in form for upate insert delete

Print topic Send  topic

Author Message

Posts: 61
Posted: 07/19/2016, 5:43 PM

I am trying to build a multi lingual site.

I have several navigation tables, menu_de, menu_fr ,menu_en
In my menu and grid I was able to use in the BeforeExecuteSelect event to set my table name depending on my on the language selected.
$my_menu->Menu1->DataSource->SQL = "SELECT * FROM menu_fr";

In my form i can use the same statement in the BeforeExecuteSelect event and if I edit a menu record the proper information is displayed in the form depending on the language selected.
But when I hit update, the record in the table that I used to build the form is updated menu_en and not my menu_fr table that I selected with the language selection.

Does anybody know on how to change the table selection in the form for the update/inserte/delete operation by custom code?

View profile  Send private message
Posted: 07/19/2016, 6:20 PM

Why not use the built-in internationalization features of CodeCharge?

Posts: 61
Posted: 07/19/2016, 8:07 PM

I do use the internationalization for all the field labels that I have in my application.
Since I am storing my menu links in tables I am switching the tables at run time depending on the language selection.

I am not sure how else to implement this.
View profile  Send private message

Posts: 513
Posted: 07/19/2016, 10:21 PM

I agree with DataDoIT - there are probably better ways of handling this.

However, as you have the code in the BeforeExecuteSelect, you can probably do a similar thing in the BeforeInsert, BeforeUpdate and BeforeDelete actions, so the table is changed then.

The BeforeExecuteSelect would probably only work on the Select.

I would also suggest making it a function that you can refer to all over the place, pass in the correct language and the object that needs changing, and it does the update. You could add the function at the end of Common.php or I use a separate Utility.php and include it in Common.php.


CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message
Posted: 07/20/2016, 6:28 AM

Rather than having a unique table per language, just add a field to your
menus table for the internationalization codes (ie: en, fr, de). Then
you can still reference the CCSLocales component and pull the applicable
translation record where needed.

switch (CCGetSession("locale","")) {
case "en":
case "fr":

Add new topic Subscribe to topic   

These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.