Configuration

Learn about internal configuration, and webmaster friendly configuration panel

This chapter will only cover the Diem additions to symfony configuration system.

See the symfony configuration documentation.

Graphical configuration panel

Sometimes, a non-developer may need to modify some configuration.
We will not ask him to edit a .yml file...

Use the configuration panel

A user with "config_panel" permission can access to the configuration panel:

configuration panel

As all options are quite intuitive, and commented on the interface, we will not describe them here.

In the code, configuration is accessed by calling dmConfig::get()

// get the site_name value
dmConfig::get('site_name')  
// get the image_resize_quality value, or 95 if not set  
dmConfig::get('image_resize_quality', 95)  

Customize the configuration panel

It's possible to add new options into the configuration panel. This is reserved to the superadmin.
In the admin top menu, go to System -> CONFIGURATION -> Settings
You will see a list of the options shown in the configuration panel.
When adding or modifying a configuration option, the fields are :

  • name the name used to fetch the value with dmConfig::get()
  • active whether the option appears on the configuration panel or not
  • group the tab where the option will be showed
  • credentials the credentials required to modify the value, separated by a space.
  • type the input type for this option
  • params if type is a select, the select options. Example for the image_resize_method option : "fit=Fit scale=Scale inflate=Inflate top=Top right=Right left=Left bottom=Bottom center=Center"
  • value the current option value
  • default the default value when creating an option

Configuration files

All configuration files support cascade ( excepted for schema.yml ).
It means that if you want a value to apply to the entire project, admin and front, you will modify it in the /config directory.
But if you want the value to only apply on front, you will modify it on the /apps/front/config directory.

config / doctrine / schema.yml

This file is used to describe the data model.

The Diem schema.yml is a flavored version of the Doctrine one.

See how to define models with Doctrine

Diem additions to schema.yml

Diem allows to declare that a column contains markdown text:

Post:  
  columns:  
    body:    { type: clob, extra: markdown }  

As body contains markdown, the admin generator will provide a markdown editor. The SEO synchronizer will also remove formatting when generating metas.

config / dm / modules.yml

A full chapter is dedicated to the module configuration

config / dm / config.yml

Declares the diem specific configuration for your site. By default the configuration is valid, so you don't need to modify it. But if you're interested in tweaking your project, you can.

all:  

  i18n:                                 # internationalization  
    cultures:             [ en ]        # Available cultures  

  search:                               # Internal search engine  
    fields:                             # Pages fields to search in, with boost level  
      id:                 0             # page doctrine identifier  
      slug:               3             # page description meta  
      name:               3             # page name ( used as link name to this page )  
      title:              2             # page title  
      h1:                 4             # page h1  
      description:        2             # page description meta  
      indexable_content:  1             # page html content  
    slop:                 10            # distance allowed between two words in a searched phrase  

  cache:                                # Cache management  
    apc:                  true          # (RECOMMENDED) Use Apc if available on current server  

  error:                                # What to do when an error occured  
    mail_superadmin:      false         # Send mail to superadmin ( uses superadmin's profile's email )  
    store_in_db:          true          # Store error in database  

  js:  
    compress:             true          # (RECOMMENDED) Performance : Minifies javascripts and put them into a single compressed file  
    cdn:                                # use cdn to load libraries  
      enabled:            <?php echo !sfConfig::get('sf_debug') ?> # (RECOMMENDED) Will use cdn to load javascript libraries faster  
      lib.jquery:         'http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js'  
    api:                                # external apis  
      gmap:                             # google maps api http://code.google.com/apis/maps/  
                                        # to configure the api key, go to the settings panel in the admin application.  
        version:          3             # api version  
        sensor:           false         # use a sensor to determine a user's location  
        url:              http://maps.google.com/maps?file=api&v=%version%&sensor=%sensor%&key=%key%  

  css:  
    compress:             true          # (RECOMMENDED) Performance : Minifies stylesheets and put them into a single compressed file  

  seo:                                  # Search engine optimization configuration  
    use_keywords:         true          # Keywords are useless for seo, but you can use them if you want  
    truncate:                           # Max length for meta fields. Can not exceed 255 characters  
      slug:               255  
      name:               255  
      title:              80  
      h1:                 255  
      description:        160  
      keywords:           255  
    sitemap:                            # see http://sitemaps.org  
      path:               sitemap.xml   # relative path from web dir where diem will generate the sitemap  

  orm:                                  # Doctrine ORM configuration  
                                        # More configuration : please use ProjectConfiguration::configureDoctrine method  
    identifier_fields:    [ name, title, slug, subject, id ] # Fields used to represent a record with a string  
    cache_enabled:        true          # (RECOMMENDED) Use doctrine query cache. No side effect, automatic cache invalidation )  
    cache_result_enabled: true          # (RECOMMENDED) Use doctrine result cache where query->dmCache() is called  
    cache_result_enabled_default: false # Use doctrine result cache on every query ( performance gain, possible issues )  

  backup:                               # keep a copy of files modified by Dm code editors  
    enabled:              true          # (RECOMMENDED) enable backup  

  web_debug:                            # web debug panel configuration  
    only_html_response:   true          # will skip web debug panel display on non html response  
    config_fast_dump:     true          # use print_r instead of sfYaml::dump to show config in web debug panel. ( ~40x faster )  

  toolBar:  
    flavour:              blue          # the toolbar flavour. Diem default values: grey, blue, green, brown, black  
                                        # You can also set a custom flavour and style #dm_tool_bar.flavour_name in your css path  

config / dm / services.yml

This file controls the Dependency Injection Container.
See the symfony documentation about how to configure it with YAML.

See the list of the Diem services you can tweak.

Questions and Feedback

If you need support or have a technical question, you can

  • Post to the google group
  • Come and chat on the #diem IRC channel on freenode