Hi all

Could anyone tell me what I would need to change in the code to allow tags to be evaluated in my site's mission statement?

Many thanks,
Andy Kimbrey

Comments

gpk’s picture

Try having a look in your theme engine (? phptemplate.engine) to see where it gets $mission or whatever from.

Alternatively it may be that the tags are stripped out when the settings page is submitted, in which case I think the relevant code will be in the system.module (you could have a look at the "variables" table in the database to see whether the PHP embedded in the mission statement has been stored in the DB).

Good luck,

gpk
----
www.alexoria.co.uk

NaX’s picture

I got PHP to work in my mission by using phptemplate.
I put something like this in template.php file.
If you already have a _phptemplate_variables() function you will have to merge this code with yours.

/**
 * Override or insert PHPTemplate variables into the templates.
 */
function _phptemplate_variables($hook, $vars) {
  if ($hook == 'page') {

    if (!empty($vars['mission'])) {      
      $vars['mission'] = filter_xss_admin(drupal_eval(theme_get_setting('mission')));
    }

  }
}
NaX’s picture

I also found that if you want to do any drupal_add_js() in your mission. You need to reset the $scripts variable.
EG:

$vars['scripts'] = drupal_get_js();

The same goes for CSS.

You could just do this in your page.tpl.php but I like the idea of keeping things together, that way if the mission changes the included JS and CSS is also edited or removed and not left behind.

derjochenmeyer’s picture

This works for Drupal 6, its not pretty but it works:

function phptemplate_preprocess_page(&$variables) {
  if (!empty($variables['mission'])) {     
    $variables['mission'] = filter_xss_admin(drupal_eval(theme_get_setting('mission')));
  }
}

Paste this code to your themes template.php

----------------------
okay.cool