Re: Newbie question

From: Date: Fri, 02 May 2003 01:54:55 +0000
Subject: Re: Newbie question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-146039@lists.php.net to get a copy of this message
On Thu, 2003-05-01 at 18:56, Justin French wrote: > on 02/05/03 11:36 AM, Michael Lewis (michael@nichestaffing.com) wrote: > > Try this: > > <? > if (stristr($_SERVER['HTTP_USER_AGENT'],'MSIE')) > { > ?> > MSIE CODE > <? > } > elseif (stristr($_SERVER['HTTP_USER_AGENT'],'Mozilla/5')) > { > ?> > Mozilla/5 code > <? > } > elseif (stristr($_SERVER['HTTP_USER_AGENT'],'Mozilla/4')) > { > ?> > Mozilla/4 code > <? > } > else > { > ?> > Generic Code > <? > } > ?> > > > In other words, the PHP syntax is: > > <? > if(...) > { > ... > } > elseif(...) > { > ... > } > else > { > ... > } > ?> > > ... and all you're doing is escaping in and out of PHP to avoid echo'ing > everything. > > > Justin French The code for the browser test that I mentioned works as is. The problem I'm having is testing for cookies. I am doing a new site for my church and I'm using frames. I wanted to see if I could set a cookie inside the <noframe> tag that I could test for on all the other pages to determine if I should display page links or not. In the framesets, all of the links are in the header and footer frames. If a user is not in frames, I want to display the links on the individual pages so they can navigate, but hide them if they are in frames. I tested your suggestion and it didn't error, but hides the links even if the cookie is set. The code is below. <? if (isset($NoFrames)) { ?> <tr> <td valign="top" align="center">&nbsp;</td> </tr> <tr> <td valign="middle" align="center"> <font face="verdana,helvetica,arial,sans-serif" color="#cccccf"size="2"><b> <a href="main.php">Home Page</a>&nbsp;&nbsp;|&nbsp; <a href="believe.html">Who We Are</a>&nbsp;&nbsp;|&nbsp; <a href="coffee.html">Coffee House</a>&nbsp;&nbsp;|&nbsp; <a href="community.html">Outreaches</a><br><img src="trans.gif" width="200" height="3"><br> <a href="house.html">House Ministry</a>&nbsp;&nbsp;|&nbsp; <a href="calendar.html">Calendar</a>&nbsp;&nbsp;|&nbsp; <a href="getSaved.html">Get Saved</a>&nbsp;&nbsp;|&nbsp; <a href="index.html">Saturday Night Church</a> </b></font></td> </tr> <? } ?> >

« previous php.general (#146039) next »