The front_page modules disables the display of the site's mission statement. This is fine except when using the module to display a separate non-themed splash screen. Then the mission statement is not shown on the home page at the regular site. In this case there are, in effect, two front pages - there's the splash screen and then there's the first page displayed at the regular Drupal-themed site. I would like the mission statement to be displayed on the home page just like stories that are "promoted to the front_page" are.

To do this, I added code to the node.module in the node_page_default function. I added "

".variable_get('site_mission','')."

" to the head of the output.

This works OK, except the mission statement is surrounded by a white margin as opposed to completely filling the width of the section as a mission statement does.

Can anyone suggest a better hack to make the mission statement appear exactly as it does without the front_page module.

Thanks,

Ken

Comments

Dublin Drupaller’s picture

two quick points Ken..

(a) front_page.module does not DISABLE the mission statement...it deliberately ignores it by design. there is a difference.

(b) <div id="mission"><?php print variable_get('site_mission', '') ?></div> will display whatever you have in your mission, wherever you want in a page.tpl.php file...or in a normal page with the php filter selected.

I hope that makes sense..it's a pity you're forced to use the mission textarea to update the top of your "front page". It's infinitely easier to use a normal drupal page and update that instead. And simply override the "HOME" links using the front_page.module settings to point to your "secondary home page".

anyway.....you might find some useful snippets at the following handbook pages..e.g. in your page.tpl.php file...you could have a <?php if this node id = 2 print the mission here ?> type thing.

http://drupal.org/node/45471

hope that helps.

Dub

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate

kloomis’s picture

> (a) front_page.module does not DISABLE the mission statement...it deliberately ignores it by design. there is a difference.

It prevents it from being displayed on the home page. You may call it a feature, but to me it's a bug. I'm not saying it's the fault of front_page. Maybe front_page exposes some issue in Drupal.

> (b)

print variable_get('site_mission', '')

will display whatever you have in your mission, wherever you want in a page.tpl.php file...or in a normal page with the php filter selected.

I feel like you're deliberately missing what I am saying. I want the mission statement to appear on the first page in the main site (not the splash page) and on every return to the home page.

> it's a pity you're forced to use the mission textarea to update the top of your "front page". It's infinitely easier to use a normal drupal page and update that instead. And simply override the "HOME" links using the front_page.module settings to point to your "secondary home page".

I don't know what the heck you mean by this. I cannot use a normal story node because is has a title and a margin. I just want to perserve the mission statement on the site exactly as it was without the splash page. Is that so hard to understand?

Can you answer the simple question, why are stories that are promoted to the front page appearing on the home page, but not the mission statement?

Dublin Drupaller’s picture

It prevents it from being displayed on the home page.

I'm not sure if you're deliberately trying to wind me up, Ken, but, the front_page.module is designed for people who want a different front_page to their site. It's *designed* not to use the mission, because, if you are using the mission, there's not much point in using the front_page.module....

go to ADMINISTER -> SETTINGS and set the DEFAULT FRONT PAGE to be a node/whatever..put your drupal files in a subfolder and use an index.html splash page in your root folder.

hope that's of use.

Dub

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate

kloomis’s picture

Dub:

I'm really not trying to be difficult. I have a client who is not happy that her mission statement is not showing up.

The front_page module is advertised as being useful for a splash page and there is the "full" setting to make it such with flash content fro example. This would be the place to allow the mission statement to show up on the home page.

If front_page is not good for a splash page then maybe there needs to be another module for that, but why not find the cause of the problem. It still doesn't make sense to me that Drupal correctly promotes stories to node, but it does not put the mission statement there.

Moving all my Drupal files to a subfolder is a drastic step I'd prefer not to make. The client would like to activate and deactivate the splash page. To her mind it's not content management if she can't do that.

Ken

Dublin Drupaller’s picture

Hi Ken,

this snippet will allow you to display the mission anywhere you want:

<?php
print variable_get('site_mission', '') 
?>

whether it's in the front_page..at the top of a node listing, in your footer, in your header, literally wherever you want.

For example...you could use the front_page.module for your splash page and then create a normal Drupal page with the PHP filter to create a very sophisticated "secondary" front page, which includes your mission at the top. There's a huge collection of php snippets that allow you to do that.

not only that, you can have a different splash page for anonymous (not logged in) and authenticated users (users logged in).

Dub

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate

kloomis’s picture

I understand how to print the mission statement. As I said, I can print it at the top of "http://example.com/node" by putting that snippet in the default_node function, but that does not exactly replicate the mission statement. The layout on the page is different. The mission statement normally spans the entire width of the home page.

It is a fact that the front_page module disables the display of the mission statement on the home page. Before the front_page module, the mission staement is displayed on the home page. After the front_page module, it is not.

Can you tell me where to put that snippet so that the mission statement prints out exaclty as it does without the front_page module. Same margins, etc.

Thanks.

Dublin Drupaller’s picture

Can you tell me where to put that snippet so that the mission statement prints out exaclty as it does without the front_page module. Same margins, etc.

Sorry Ken, perhaps I wasn't clear when I explained alternative solutions to you..

This code maybe placed *anywhere* in your site. whether it's a front_page.module, a normal page with the php filter, your page.tpl.php file, or [em]any[/em].tpl.php file.

<div id="mission"><?php print variable_get('site_mission', '') ?></div>

I hope that makes sense

Dub

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate

kloomis’s picture

No, it doesn't make sense. I don't want to place it anywhere, I want it on the home page.

Can you tell me where to place the code to have the mission statement appear on the home page just as it does without the front_page module?

Ken

Dublin Drupaller’s picture

Hi Ken,

If you still haven't worked it out yet...here's an example.

  1. Go to ADMINISTER -> SETTINGS -> FRONT_PAGE
  2. In the text area for your front page for ANONYMOUS USERS, paste in the following snippet
  3. Select the ALLOW PHP IN PAGE option and set to FULL PAGE so your splash flash fills the screen
  4. Edit the snippet (yoursite.com) to match your site
  5. save settings.
  6. Make sure your MISSION STATEMENT is enabled under ADMINISTER -> THEMES
  7. Just tested this in 4.7. Works perfectly and I have added notes in the snippet so you know where to put what

Notes:In simplicity, the way it works is if a visitor is coming from within your site...i.e. yoursite.com, it displays the Mission + recent nodes. if the visitor is coming from offsite, i.e. not from within your site, they are displayed the splash page.

<?php

/**
* Change the $yoursite value to your website address
*/

$yoursite = "yoursite.com";

/**
* paste your flashsplash HTML content in between the quote marks in the next line. 
* It can run as many lines as you want as long as it begins and ends 
* with the quotemarks.
*/
$flashsplashcode = 'paste your flashsplash HTML code here';


/**
* check to see where the visitor is coming from
* 
*/

$ref = $_SERVER["HTTP_REFERER"]; 

    if  (!stristr($ref, "$yoursite"))  { 

    //Offsite referrer detected so display the full splash/flash page.
    print $flashsplashcode; 
    } 

   else {
/**
* This php snippet displays the 10 most recent weblog entries with
* teaser & info.
*/
  $listlength=10; //determines the amount of weblog entries displayed. increase or decrease to suit.
  $result1 = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), $listlength);
  while ($node = db_fetch_object($result1)) {
    $output .= node_view(node_load(array('nid' => $node->nid)), 1);
  }
print theme('page', $output); // displays the output as a themed page to include the mission.
} 
?>

If you want your "secondary" front_page to display as a full page as well...just change the last line from print theme('page', $output); to print $output;

Hope that helps.

Dub

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate

gateone’s picture

While front_page is a great module, maybe you might also want to take a loot at the Views module, which goes far beyond what front_page can actually do. It is not always the right solution, especially if you need a completely different front page, but if you'd just like to change the way your teasers look e.g. or want some custom content before or after teasers, or no teasers at all, or teasers just for a specific taxonomy term e.g., views might be your new best friend for that goal.

kloomis’s picture

Views sounds good and I'll definitely look into it, but what I need is an entirely non-Drupaled-themed splash page - it will have flash content, etc. with a link to the regular Drupal site. I want the Drupal site to be exactly - not one iota different - like it was before the introduction of the splash screen. I want the administor to be able to turn the splash screen on and off and create and edits its content. I believe this is how a splash screen should work. Perhaps we need a different module.

HOWEVER, if this one deficiency in the front_page module could be overcome, we would have such a module. The developer seems more interested in fighting me than contemplating a possible solution. I'd do it myself if I understood the innards of Drupal better.

Ken

abqaria’s picture

Dear All
Thanks for your great effort, but could someone help me in this one
i found it hard to to make custom front page that dispalys a thiings like the default frontpage.

so i decided to use the mission or make a page entry an make it sticky...

can anyone help me to do this simple thing

"display mission to new users and do not display it in logged in users"

thanks in advance

A Shoukry

abqaria’s picture

i managed to redirect users to their own blogs

and display the mission for non logged users... but i displayed only the mission

is it possible to display the mission and the rest of the default page?

abqaria’s picture

dear all
please help i am totally confused

what is the default frontpage name to direct the front page module to it ?

also i have a problem with home link, whenever i click on it , it doesnt show that i am logged in ! bu all other links show that i am logged in why

jcavell’s picture

I have just read this discussion.

Dub has gone out of his way to be helpful, pasting code and trying to work out exactly what your problem is. He doesn't (to my knowledge) get paid for this.

Drupal is pretty hard to use at times, there is no doubt about it. But it helps to remain courteous, as nobody is going out of their way to annoy you. If you can work out a way to improve the module, then why not submit a patch?

Jonny

Dublin Drupaller’s picture

hi Jonny,

You're right..I don't get paid for helping out..although as a maintainer of a few modules, I do try my best to answer questions + improve the module as more people use them.

Other developers tend to approach maintaining their modules as if they did get paid for it...which I think is a good philosophy to have, as it strengthens the project and enbodies a trust in the code and Drupal in general, that I think is unique among the many Web 2.0 and community development Tools out there.

Having said that, my contributions to Drupal are minor compared to what some others have put in....so when I come across someone who is abrasive, lazy or has the social skills of a dingbat, I just tend to refrain from speaking my mind and just help if I can.

cheers

Dub

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate

Phillip Mc’s picture

HI dub,

I think you might be too accomodating sometimes, it's better to encourage users like these to fend for themselves. FWIW nobody has mentioned that it's considered extremely bad design policy to have a flash front end as Ken describes.

Phil

kloomis’s picture

Thanks Dub for the snipet. I haven't tried it yet, but it sounds like it will do the trick.

I really don't think I was being abusive or lazy (I read thru Drupal code until my eyes crossed) and I don't see any need to resort to name-calling, even if indirectly. You see, there was a solution, so I wasn't asking for something impossible. I understand you have no obligation to solve my problems, and I have no expectation that you will, but I think it's only honest to say OK I see your problem, I can see where for this use of the module it doesn't work as it might. Aside from that, I really appreciate your looking into it and coming up with a solution.

As for the design policy, I can't tell my customer that his idea is "bad design," and as far as I can tell a flash front end is quite common for band sites which this one is, and it's all flashy and groovy and cool. So, de gustibus.

Anyway, thanks and pax vobis cum.

Ken

Dublin Drupaller’s picture

Hi Ken,

Thanks, but, there's no real need to apologise or thank me, Ken. I sorta guessed, after explaining and repeating the same thing on numerous occasions, that if someone didn't do the work for you...you would post more snide and insulting remarks, so, all I did was copy and paste 2 snippets from the handbook. It didn't take much time to find them, I just used the Drupal.org search facility to dig them out.

As a tip, when looking for help on Drupal stuff, it's best to try and remain courteous - I would tend not to accuse people who are helping you out of "attacking you". Some might find that insulting or at the very least, irritating. I tend to rise above that David Brent style of social interaction, but, I imagine many others on here would probably not be so patient.

On the subject of flash front pages, I have to agree with PhilK who correctly pointed out that it's extremely bad design policy to use a flash front page as you described. Not only is it a bad design policy, but, it would be considered very unprofessional for a site designer to standby and allow it.

If you know how to use www.google.com (it's a search engine)...there are some interesting documents and discussions on the matter.

Dub

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate

kloomis’s picture

I put the php code from above into the front_page text area, triple and quadruple checked all the settings (enable php, enable mission statement in global and theme settings, make front_page the default front page, use full page, etc) and still I get no mission statement on the main site home page. There's a link to the main site from the splash sceeen and whether the user is coming from the splash sceen or from within the site's pages to "home" there is no mission statement displayed. This is a 4.6 installation. Baiscally, it's the same whether I use the plain vanilla front_page setup or use the embedded php.

Ken

elbarcino’s picture

Dear all,

I'm running a sports site based on drupal 4.6.. and it has been online for about 4 months which has to be updated every day.

Since I have no idea about programming - I'm only using drupal.org documentation and handbooks - I decided to use the mission statement as a "container" to put different kinds of content displayed as "headlines" including flash, tables, links to content, etc...along with other nodes, etc. on the front page...

The number of visitors is rasing real fast and I have some adverstiser on the website, but since I want to keep the site as clean - free from advertising - as possible (I mean I also need to pay my bills but don't want a site featuring Adsense links, blinking banners and sorts....I considered disrecpectful to the visitors). So I decided to use the front_page.module with a splash site featuring a fullsize banner for advertisers willing to pay...or random images in the case there are no advertisers....or other types of content...

the splash site is working fine, the problem is that the mission statement now dissapears....

I'll really appreciate any help.

Thanks

Phillip Mc’s picture

hi elbarcino,

goto administer >> settings >> front_page

In your text settings area paste in the following snippet wherever you want your mission to appear in your front_page.

<div id="mission"><?php print variable_get('site_mission', '') ?></div>

before saving, select the checbox that says "allow embedded PHP.."

If you set it to THEMED, it will pick up the styling of the #mission class in your style.css, if you set it to FULL, you need to style it yourself.

As a tip, it's probably not a good idea to use the mission for adverts on a Drupal site. the reason is the person updating the adverts requires Full Admin access to the site, just to do that.

Sometimes it's better to nominate a node, that's not "promoted to front page", but accesible by the site editor, who can update the ad, like a normal node.

this snippet will pick up the Main body (only) of the node ID = 11 and display it wherever you paste the snippet.

$node_id = 11; 
$_node = node_load(array('nid' => $node_id));
print $_node->body;

If you use that snippet, instead of the mission snippet, it means that it's much easier to update the advert, the person updating the advert doesn't have to have full site admin access (which is dangerous for obvious reasons) and you can put it in your page.tpl.php file (so it appears on all pages).

Phil.