new to fuelcms: is it possible to create a multilingual CMS?

edited November 2014 in Modules
I'm new to fuelcms but i developed a complex multilingual CMS-CRM using Codeigniter for frontend and ATK/Achievo as backend.

Is it possibile to merge all the functionality in FuelCMS? Expecially the backoffice i wonder if its possibile to create models in fuelcms in the same way i did with ATK/Achievo.

My main concern is the multilingual CMS, it has 2 main tables: content1 and content2.

- Content1 contains the common content shared parameters, foreign keys, but no strings.
- Content2 is joined to content1 on primary key content_id and contains the translated strings (title, description, slug, body, publish date, etc.)

I.e. when i edit a page i've a tab with general settings and a tab for each available translations (including the default language);
if tabs are not possibile a table will be ok too.

Is this replicable in fuelcms or i've to create a "view" in mysql and use that one as a "big table" for the model?

Thanks for any suggestions!

Antonio

Comments

  • edited 9:06AM
    That's a really difficult question to answer not knowing much about ATK/Achievo and how your specific application is setup. FUEL CMS does support multiple languages when creating pages and blocks. Also, if you create a simple module (a wrapper around a table usually) and include a "language" field, that will trigger additional functionality in the system as well as allows you to query on the language in a where condition. I would recommend playing around with FUEL and reviewing the following documentation including the language configuration settings that you can add to your fuel/application/config/MY_fuel.php (those prefixed with "language):
    http://docs.getfuelcms.com/installation/configuration
    http://docs.getfuelcms.com/general/localization
    https://ellislab.com/codeigniter/user-guide/libraries/language.html
  • edited 9:06AM
    I did some test creating a custom module and looks promising but i get stuck at a big problem with relations.

    It seems that relations are handled via a select combobox or with a shuttle-object (in has_many).

    This works ok for a list of 100 records or such.

    I've relations with 100.000 records and need a different approach because a SELECT or the shuttle does not work well and crash the browser or makes PHP out of memory.

    Does fuelcms provide in the core some solution for this?

    In ATK/Achievo i've a ajax search box that allow to search and then add it to a table that automatically grows.
  • edited 9:06AM
    I would recommend creating a custom field type using something like Select2:
    http://ivaynberg.github.io/select2/

    There is a blog post that you can use for a reference in creating a custom field type:
    http://www.getfuelcms.com/blog/2013/12/17/creating-a-color-picker-custom-field
    http://docs.getfuelcms.com/general/forms#association_parameters

    As a starter, you could do something like the following:
    1. Download the files from http://ivaynberg.github.io/select2/
    2. Place the CSS files in an assets/css/select2 folder
    3. Place the JS files in an assets/js/select2 folder
    4. Add the following code to the fuel/application/config/custom_fields.php file:
    $fields['tags'] = array( 'class' => 'MY_custom_fields', 'function' => 'select2', 'css' => 'select2/select2', 'js' => array( 'select2/select2', ), 'represents' => array('name' => 'tags'), );
    5. Create a the file fuel/application/libraries/MY_custom_fields.php and place the following in it:
    class MY_custom_fields { function select2($params) { $form_builder =& $params['instance']; $js = '<script type="text/javascript"> $(function(){ $(".field_type_tag").select2(); }) </script> '; $form_builder->add_js($js); $params['class'] = (!empty($params['class'])) ? $params['class'].' field_type_tag' : 'field_type_tag'; $params['type'] = 'select'; return $form_builder->create_select($params); } }

    Now in your simple module's model, the form_fields method you can use the type of "select2" like the following:
    function form_fields($values = array(), $related = array()) { $fields = parent::form_fields($values, $related); $fields['my_field'] = array('type' => 'select2'); return $fields; }
    More on creating a simple module can be found here:
    http://docs.getfuelcms.com/modules/tutorial
  • edited 9:06AM
    Thank you very much, this is very usefull, it solves the problem with the many-to-one relation.

    Still need to find a solution for the many-to-many :)
  • edited 9:06AM
    If you add the following to the MY_custom_fields::select2 method, it will allow for multiple selections:
    $params['multiple'] = TRUE;
  • edited 9:06AM
    Yes i know but i need to display a table with additional columns of the product added to the order :)
Sign In or Register to comment.