3

I follow the guide in Grocery CRUD web documentation, but I can't find if this library suport operations for a multilanguage application. let's say I have a table articles, where I have a column "lang",

id   lang      title
1     EN      Title for en
1     DE       Title for de

How can I use or modify the view for edit, to put there tabs, or a dropdown. Can I do this with Grocery? If you another library, please share with us.

Thanks in advance

complex857
  • 20,425
  • 6
  • 51
  • 54

1 Answers1

2

A typical Grocery CRUD DB table could be shown with something similar to:

        $crud = new grocery_CRUD();

        $crud->set_table('Products');
        $crud->set_subject('Product');

        $crud->columns('id', 'Name', 'Price')
            ->display_as('Name','Product Description');

        $output = $crud->render();

As you can see, the field names are passed as strings, and the table header can be changed using the *display_as* method. As a result, you could use a simple selection to set a variable to the field name you want to use, and then pass that variable to GroceryCRUD:

        $lang = 'EN';
        $description= 'Product Description';
        $crud->columns('id', $lang, 'Price')
            ->display_as($lang, $description);
jrierab
  • 605
  • 5
  • 15