Hi -

I'm a web designer who is new to Drupal. I am interested in having the mission statement appear on all pages. I have completed a very thorough search about getting the mission statement to appear on all pages. I am not well versed in php, but am working on it. I saw this post: http://drupal.org/node/184590. I was wondering if someone can tell me where in Zen's template.php file I can included the following:

<?php
function _phptemplate_variables($hook, $vars = array()) {
  // Make custom variables available to theme templates
  switch ($hook) {
    // Send new variable $custom_mission to page.tpl.php
    case 'page':
      $vars['custom_mission'] = variable_get('site_mission', '');
      break;
  }
  return $vars;
}
?>

I can see where the following appears in themplate.php:

function _phptemplate_variables($hook, $vars = array()) {

...but whenever I add the function my site errors out. I've tried different combinations in different places after the above line, but I'm coming up empty handed. I feel like I'm so close to getting this to work! I'm left wondering why there isn't a function for showing the mission statement/site information on all pages like there is for the blocks and such.

Thanks so much!!

^__^

Comments

goldschmidt.a’s picture

Hi,

I know this isn't the ideal solution, but then again, it may give you more control in some ways. You can try integrating your site's mission statement simply as a block viewable on all pages. I'm using Zen theme myself, and decided to integrate my site's mission statement in with the logo in the header. Since my mission statement is very short, it works, but just using a block in the nav-bar or content-top area works pretty well for something like a mission statement too.
In order to put the mission statement in as a block, you would disable the mission statement from the theme's checkboxes and create a new block for it.

Sincerely,
Andrew G

lredesigns’s picture

Ah yes... unfortunately I tried that earlier. My mission statement is floated to the right of the logo. I tried making it a block before, but I couldn't get the block to appear next to the logo. When I looked for how I could create a new region, I came across this info: http://drupal.org/node/29139. Which brings me to the same issue of editing the template.php file. I tried deleting the file and starting a fresh one, but there's php that the Zen's/sub theme's template relies on. My theme is a sub-theme of the Zen.

- Thanks for the feedback Andrew!

WorldFallz’s picture

which version of zen? And did you create a subtheme?

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz

lredesigns’s picture

Zen for Drupal 5.7 - and yup - I've created a subtheme of Zen

lredesigns’s picture

Also... I did not mention... The download for Zen includes the STARTERKIT folder. I copied that and made it another subtheme. To get a bit more customization, I copied Zen's page.tpl.php file and placed it in my subtheme's folder. Within page.tpl.php, I moved the mission code block:

        <?php if ($mission): ?>
          <div id="mission"><?php print $mission; ?></div>
        <?php endif; ?>

...up so that it could be floated next to the logo. It would just really rawk if the mission appeared on every page!

WorldFallz’s picture

ok, first, in your template.php find:

function STARTERKIT_preprocess_page(&$vars) {
  $vars['sample_variable'] = t('Lorem ipsum.');
}

and replace it with

function STARTERKIT_preprocess_page(&$vars) {
  $vars['custom_mission'] = variable_get('site_mission', '');
}

Then, in your page.tpl.php find:

<?php if ($mission): ?>
    <div id="mission"><?php print $mission; ?></div>
<?php endif; ?>

And replace it with:

<?php print '<div id="site-mission">'.$custom_mission.'</div>'; ?>

let me know if it works....

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz

lredesigns’s picture

Works perfectly!! Thank you so much! This has been haunting me all day.

*^__^*

WorldFallz’s picture

lol, you're welcome.

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz

drupalfever’s picture

I don't want to sound like a wisea$s but isn't it easier to just do the following?


  echo '<div id="site-mission">' . variable_get('site_mission', '') . '</div>';