PDA

View Full Version : Help The Mentally Challenged


caislander
11-27-2002, 03:39 AM
Hey guys I am feeling pretty darn challenged :( I need to add a browser check to my forum main page so I can serve a watered down version of our header to viewers using NS 4.xx, so I have this function
<?php
function doriteheader() {
// serve correct header by browser
global $HTTP_USER_AGENT;

if (eregi("Mozilla/4.",$HTTP_USER_AGENT)) { // browser is NS4
return "$footer";

} else { // other browsers
return $header;

}

}
?>
I tried placing this in the template, but that didn?t work so I am (don?t laugh too hard I new at this) assuming that means I can?t include php directly in the template. So if that is true where do I place this function so that I can control which header is called in the forum_home template? (I used footer in place of my second header name so it was easy to see if this worked or not)

ps; if this isn't where this post should be, someone please move it where it should
go
As always thanks for your time

Velocd
11-27-2002, 09:23 PM
Not entirely sure what your intent is, since I briefly skimmed to the problem, but you are correct that PHP code cannot be added directly into the template.

If it is affecting the forum_home template, try placing the code in the index.php file of your forum root directory.

drews
11-27-2002, 09:26 PM
you can try puttin that code in the phpinclude template. I think that is the only template that allows PHP.

Erwin
11-28-2002, 12:25 AM
drews is correct. Also, the forum global.php file can be used too.

drews
11-28-2002, 01:52 PM
Wow...i was right..strike up another tally for the amount of time i have been right....Hey, I am up to.... one ....now... lol.

caislander
12-05-2002, 03:32 AM
I still haven't been able to figure this out :( I tried putting my function in each of the places suggested thus far and can't get it to work. So let me try & tell you what I am trying to do maybe someone can suggest a better way.
We have a header that fails (really goes to pieces) in NS 4.xx so somehow we need to determine if the viewer is useing NS 4.xx and if so serve them an alternate header (actualy an alternate set of buttons) is there some other way to do it?