Topic: punBB announcements: only on home page?

Hi,
One user got a little confused by an announcement of mine being displayed on all forum pages.  Is it possible to have the announcement displayed only on the "home" page of my foruns?
Thanks,

Re: punBB announcements: only on home page?

Try this. Open up header.php and look for

if ($pun_config['o_announcement'] == '1')

and replace it with

if ($pun_config['o_announcement'] == '1' && basename(__FILE__) == 'index.php')

This is a code modification so I'll move it to the mod forum.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3 (edited by anatman 2004-03-29 07:30)

Re: punBB announcements: only on home page?

Thanks Rickard.
I tried it (locally, at home), but it didn't work: the announcement will not show anywhere with this mod.  Which surprised me, i thought it would work...
any ideas?

edit: would you like me to put it online, so you can see it?

Re: punBB announcements: only on home page?

Hmm, that's odd. I can't find anything wrong with the code. Try adding the following line to the top of header.php:

exit(basename(__FILE__));

And tell me what it outputs.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: punBB announcements: only on home page?

The output was "header.php", on a blank background...
Could this odd beahviour be because i am running this mod (and the test you just told me to) locally, on my mac ?  I can try this online if you think it is worth it.

Re: punBB announcements: only on home page?

Ah, of course! I'm an idiot :) Try this instead:

if ($pun_config['o_announcement'] == '1' && basename($_SERVER['SCRIPT_FILENAME']) == 'index.php')

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: punBB announcements: only on home page?

Yes, that works!
Thanks a lot, Rickard.