I'm in the process of creating a drupal site using the Zen theme (which I've modified) and want to utilize the mission statement. Right now, the Mission Statement is checked and shows up on the front page, and the front page only. I want this to show up on every page. Below is my current code in the page.tpl.php file:
...
<div id="banner">
<?php if ($mission): ?>
<div id="mission">
<?php print $mission; ?>
</div>
<?php endif; ?>
...
I want to leave drupal's functionality in tact, meaning if the Mission Statement is checked it shows up on every page, but if it isn't checked, it wouldn't show up on any page. Now I'm not a PHP guru by any stretch of the imagination, but the above code seems like it checks to see if the Mission Statement box is checked and if so it "prints" it to the page. I just can't figure out why it only does it to the front page. I could not find any other reference in the mission statement. Is there an "isfront" constraint somewhere else that i'm missing? if so, it's not in the page.tpl.php file.
Any help is greatly appreciated.
:cD
Comments
=-=
inspect your template.php ?
template.php
Not sure exactly what I'd be looking for, but I don't see any references to the mission statement. However, my noobness tells me that the
$body_classes[]are playing a part. Below you will find the code in my page.tpl.php and template.php files.page.tpl.php
template.php
Try something like this: In
Try something like this:
In template.php (create it if necessary) add a function _phptemplate_variables() thus:
Then in page.tpl.php use $custom_mission, which will be available on every page.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
NICE!
This worked to perfection, thank you!
:-)
:-)
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
mission
where in the page.tpl.php file should i input the code
$custom_mission
and is this the complete code for that file?
gigfish
Maybe this is stupid, but
Would changing
to
Not force it to always print, regardless?
=-=
He still wants control over it in the admin area, which your method would take away.
1. That wouldn't make
1. That wouldn't make $mission appear on pages where it currently doesn't ... it would simply mean that an empty
<div id="mission">is output when $mission is the empty string2. IIRC most themes only populate $mission when on the front page
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Is there a way to replace
Is there a way to replace the mission with something else when switching to other pages ?
ie front page = mission , all other pages = other content
=-=
http://drupal.org/node/104316
create a page-front.tpl.php which will include the mission statement
then remove it from page.tpl.php, or use an if else statement to remove it.
mission
Hi great it seems u found a solution - for not teckie types like me can u tell me what code i should paste into the page-front.tpl.php file
much appreciated.
gigfish
=-=
read page.tpl.php and find the references to mission
should be something like
though if you are using a 3rd party threme it could be a bit different
Thank You!!
Exactly what I needed for my theme! I'm guessing that Drupal core empties the $mission variable on pages other than the front page. Worked like a champ!
>I'm guessing that Drupal
>I'm guessing that Drupal core empties the $mission variable on pages other than the front page.
Correct. $mission is defined at the top of this function http://api.drupal.org/api/function/phptemplate_page/5.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Quick and Dirty Solution
Hi, I am new to drupal, but I think I have a very quick and easy solution. I had the same issue. When I tried to get the template.php hook working it did not solve the mission issue. So I added the following directly to the page.tpl.php file.
print variable_get('site_mission', '');There must be a reason why this is not the 'drupal' way, but it works like a charm.
This doesn't work in drupal 6
This doesn't work in drupal 6 :(
Drupal 6
For Drupal 6, this works:
print theme_get_setting('mission');In fact, I'm using this, to ensure the mission statement is clean:
(read more on filter_xss and filter_xss_admin)