Cannot use drupal_set_messages in a custom controller module
You might want to try

return array(
  '#theme' =&gt; 'ctr',
  '#myvar' =&gt; 'myvalue',
);


And then define a hook_theme.

/**
 * Implements hook_theme().
 */
function ctr_theme($existing, $type, $theme, $path) {
  $variables = array(
    'ctr' =&gt; array(
      'template' =&gt; 'cntr',
      'variables' =&gt; array(
        'myvar' =&gt; 'defaultvalue',
      ),
    ),
  );
  return $variables;
}