When path aliases are used for nodes, and the theme is told to display the mission statement, the mission will not display if the home page in /admin/settings is set to an alias.
To reproduce this do the following:
1. Go to /admin/modules and enable the path module, if not already enabled
2. Create a node of type page, and enter an alias for it (e.g. home.html)
3. Go to /admin/settings and set the Drupal default front page to be home.html
4. Go to admin/themes and select Pushbutton (or any theme using xtemplate engine), make it the default
5 Go to /admin/themes/settings and enable Mission statement
Now go to the home page of your site, and you will NOT see the mission displayed.
Some debugging shows that the culprit is this section of code in /themes/engines/xtemplate/xtemplate.engine:
if ($_GET["q"] == variable_get("site_frontpage", "node") && theme_get_setting('toggle_mission') && ($mission = theme_get_setting('mission'))) {
$xtemplate->template->assign("mission", $mission);
$xtemplate->template->parse("header.mission");
}
The problem is $_GET["q"] stores "node/1" and not "home.html", so the above condition is never met, and the mission does not get displayed.
The workaround is to put in /admin/settings the drupal node path (e.g. node/1) instead of home.html, the mission will be displayed then.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | mission.patch | 460 bytes | budda |
| #4 | phptemplate.diff | 685 bytes | kuba.zygmunt |
Comments
Comment #1
killes@www.drop.org commentedxtemplate is no longer part of core.
Comment #2
kbahey commentedThe problem still occurs on phptemplate themes (e.g. Pushbutton) under 4.6.
Comment #3
eferraiuolo commentedI also have run into this problem but from a different angle. I tried using taxonomy terms to be displayed on the front page along with the mission statement; I can get this to work, but not without getting an error/warning. So I tried creating an URL alias for my taxonomy terms url, but then the mission statment wasn't being displayed as you pointed out!
Example:
I set Administer >> Settings >> Default front page to:
taxonomy/term/15,7
Also Mission Statement is toggled on under Administer >> Themes and the result was what I was after; the front page displaying the mission statement along with all content tagged with Term 15 & Term 7. But I also got something I didn't want, a Warning/Error:
warning: preg_match() [function.preg-match]: Unknown modifier 't' in /home/ewebportals/web/public/schoolcraft/modules/block.module on line 474.To Fix the Error I did:
I created an URL Alias in Administer >> URL Aliases
System Path: taxonomy/term/15,7
Alias Path: everyone/common
I then replaced taxonomy/term/15,7 (my default front page URL) to everyone/common; but the error was still present, and I lost my mission statement.
Finally I edited my URL Alias from everyone/common to everyone_common; this got rid of the error, but still my mission statement wasn't being displayed.
My Debug Trace:
I tried to track down my error and ended up the same place you did, but my theme is using PHPTemplate Engine; so I tracked the bug to file:
themes/engines/phptemplate.engine:
Comment #4
kuba.zygmunt commentedTo solve this in phptemplate I check if in database exists alias for main page(table {url_alias} ) and then check
if ( ($_GET['q'] == variable_get('site_frontpage', 'node')) || ($_GET['q'] == $alias->src ) )Comment #5
kuba.zygmunt commentedfor me this diffs works so I change the status to patch
Comment #6
aaron commented+1 for 4.6.3. I haven't tested it in 4.7. Fixes the problem without a hitch, from what I can tell.
Comment #7
moshe weitzman commentedI think the right thing to do is to use drupal_get_normal_path() and then compare to $site_frontpage
Comment #8
buddaCan't believe this still hasn't been fixed since 4.6 days.
Attached is a patch against the phptemplate.engine from Drupal HEAD
Comment #9
markus_petrux commentedYou may want to remove
$frontpageor set it in the variables array. It is not used, actually.Comment #10
buddaThe
$frontpagevariable is there all along in phptemplate.engine, I don't know what it's intended for so have not touched it.This patch is to fix the broken mission statement bug, and fixes this. Cleaning up other phptemplate code can be done seperately.
Comment #11
dries commentedCommitted to HEAD. Thanks.
Comment #12
(not verified) commented