(REPOST) What"s wrong with this code?

(REPOST) What"s wrong with this code?

am 11.04.2008 09:05:39 von Ronald Raygun

$cssfile =
(stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
echo
"


This is a test

Hello world!

"
?>


The result in the browser is still:

Hello world! " ?>

- am I missing something?

Re: (REPOST) What"s wrong with this code?

am 11.04.2008 09:16:56 von Lars Eighner

In our last episode, , the lovely
and talented Ronald Raygun broadcast on comp.lang.php:


> > $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "
>
>
> This is a test
>
> Hello world!
>
> "
> ?>


> The result in the browser is still:

> Hello world! " ?>

> - am I missing something?


Yes, you are missing a basic level of skill in HTML and a semi-colon at the
end of your echo statement.

--
Lars Eighner usenet@larseighner.com
Countdown: 284 days to go.

Re: (REPOST) What"s wrong with this code?

am 11.04.2008 09:16:56 von Lars Eighner

In our last episode, , the lovely
and talented Ronald Raygun broadcast on comp.lang.php:


> > $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "
>
>
> This is a test
>
> Hello world!
>
> "
> ?>


> The result in the browser is still:

> Hello world! " ?>

> - am I missing something?


Yes, you are missing a basic level of skill in HTML and a semi-colon at the
end of your echo statement.

--
Lars Eighner usenet@larseighner.com
Countdown: 284 days to go.

Re: (REPOST) What"s wrong with this code?

am 11.04.2008 09:20:58 von Erwin Moller

Ronald Raygun schreef:
>
> > $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "
>
>
> This is a test
>
> Hello world!
>
> "
> ?>
>
>
> The result in the browser is still:
>
> Hello world! " ?>
>
> - am I missing something?
>

Yes, you miss error and notices reporting.
You suppres errors, so you don't see them on screen.

This is what I get:
Parse error: parse error, unexpected ',', expecting ']' in
/home/compernolle/public_html/user/test.php on line 2

Solution? Make sure you have all errors/notices/etc ON during
development/debugging.

Regards,
Erwin Moller

Re: (REPOST) What"s wrong with this code?

am 11.04.2008 09:20:58 von Erwin Moller

Ronald Raygun schreef:
>
> > $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "
>
>
> This is a test
>
> Hello world!
>
> "
> ?>
>
>
> The result in the browser is still:
>
> Hello world! " ?>
>
> - am I missing something?
>

Yes, you miss error and notices reporting.
You suppres errors, so you don't see them on screen.

This is what I get:
Parse error: parse error, unexpected ',', expecting ']' in
/home/compernolle/public_html/user/test.php on line 2

Solution? Make sure you have all errors/notices/etc ON during
development/debugging.

Regards,
Erwin Moller

Re: (REPOST) What"s wrong with this code?

am 11.04.2008 20:21:40 von luiheidsgoeroe

On Fri, 11 Apr 2008 09:05:39 +0200, Ronald Raygun =

wrote:

>
> > $cssfile =3D =

> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "
>
>
> href=3D\"$cssfile\" />
> This is a test
>
> Hello world!
>
> "
> ?>
>
>
> The result in the browser is still:
>
> Hello world! " ?>
>
> - am I missing something?

The obvious error is offcourse browser sniffing (and my opera occasional=
ly =

has to fake being MSIE to get sites to comply with me...). If you need =

some MSIE specific CSS rules (which nowadays for a competent designer wi=
th =

enough knowledge of CSS is no more then a few lines on even a big site),=
=

I'd always advise using MSIE conditional comments.
-- =

Rik Wasmus

Re: (REPOST) What"s wrong with this code?

am 12.04.2008 02:24:32 von spam

"Ronald Raygun" wrote in message
news:VYGdnWndgNVkkGLanZ2dnUVZ8q_inZ2d@bt.com...
>
> > $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
^ No closing bracket. ^
- Also, outer pair of parentheses are unnecessary, but no syntax error.
> echo
> "
>
> />
> This is a test
>
> Hello world!
>
> "
^ Missing semicolon.
> ?>
>
>
> The result in the browser is still:
>
> Hello world! " ?>
>
> - am I missing something?

Re: (REPOST) What"s wrong with this code?

am 12.04.2008 02:24:32 von spam

"Ronald Raygun" wrote in message
news:VYGdnWndgNVkkGLanZ2dnUVZ8q_inZ2d@bt.com...
>
> > $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
^ No closing bracket. ^
- Also, outer pair of parentheses are unnecessary, but no syntax error.
> echo
> "
>
> />
> This is a test
>
> Hello world!
>
> "
^ Missing semicolon.
> ?>
>
>
> The result in the browser is still:
>
> Hello world! " ?>
>
> - am I missing something?

Re: (REPOST) What"s wrong with this code?

am 13.04.2008 12:11:05 von Andrew Bailey

"Ronald Raygun" wrote in message
news:VYGdnWndgNVkkGLanZ2dnUVZ8q_inZ2d@bt.com...
>
> > $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "
>
> > />
> This is a test
>
> Hello world!
>
> "
> ?>
>
>
> The result in the browser is still:
>
> Hello world! " ?>
>
> - am I missing something?
>
>
>
>

FWIW I would use...

$cssfile =
(stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';




This is a test

Hello world!


?>

Andy

Re: (REPOST) What"s wrong with this code?

am 13.04.2008 12:11:05 von Andrew Bailey

"Ronald Raygun" wrote in message
news:VYGdnWndgNVkkGLanZ2dnUVZ8q_inZ2d@bt.com...
>
> > $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "
>
> > />
> This is a test
>
> Hello world!
>
> "
> ?>
>
>
> The result in the browser is still:
>
> Hello world! " ?>
>
> - am I missing something?
>
>
>
>

FWIW I would use...

$cssfile =
(stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';




This is a test

Hello world!


?>

Andy

Re: (REPOST) What"s wrong with this code?

am 13.04.2008 17:05:24 von lws4art

Andrew Bailey wrote:
>
> "Ronald Raygun" wrote in message
> news:VYGdnWndgNVkkGLanZ2dnUVZ8q_inZ2d@bt.com...
>>
>> >> $cssfile =
>> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>> echo
>> "
>>
>> >> href=\"$cssfile\" />
>> This is a test
>>
>> Hello world!
>>
>> "
>> ?>
>>
>>
>> The result in the browser is still:
>>
>> Hello world! " ?>
>>
>> - am I missing something?
>>
>>
>>
>>
>
> FWIW I would use...
>
> > $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>
>
>
>
> This is a test
>
> Hello world!
>
>
> ?>
>
> Andy
>
I think you meant:
$cssfile =
(stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
//close php script here and start html document
?>



This is a test

Hello world!





--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Re: (REPOST) What"s wrong with this code?

am 13.04.2008 17:05:24 von lws4art

Andrew Bailey wrote:
>
> "Ronald Raygun" wrote in message
> news:VYGdnWndgNVkkGLanZ2dnUVZ8q_inZ2d@bt.com...
>>
>> >> $cssfile =
>> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>> echo
>> "
>>
>> >> href=\"$cssfile\" />
>> This is a test
>>
>> Hello world!
>>
>> "
>> ?>
>>
>>
>> The result in the browser is still:
>>
>> Hello world! " ?>
>>
>> - am I missing something?
>>
>>
>>
>>
>
> FWIW I would use...
>
> > $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>
>
>
>
> This is a test
>
> Hello world!
>
>
> ?>
>
> Andy
>
I think you meant:
$cssfile =
(stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
//close php script here and start html document
?>



This is a test

Hello world!





--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Re: (REPOST) What"s wrong with this code?

am 13.04.2008 19:37:40 von Preventer of Work

Ronald Raygun wrote:
>
> > $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "
>
>
> This is a test
>
> Hello world!
>
> "
> ?>
>
>
> The result in the browser is still:
>
> Hello world! " ?>
>
> - am I missing something?
>
>
>
>

Compare:

$cssfile =
(stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';

$cssfile =
(stristr($_SERVER['HTTP_USER_AGENT'],'msie'))?'ie.css':'ff.c ss';

Note the new ] that was missing.

You owe me a beer.

Re: (REPOST) What"s wrong with this code?

am 13.04.2008 19:37:40 von Preventer of Work

Ronald Raygun wrote:
>
> > $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "
>
>
> This is a test
>
> Hello world!
>
> "
> ?>
>
>
> The result in the browser is still:
>
> Hello world! " ?>
>
> - am I missing something?
>
>
>
>

Compare:

$cssfile =
(stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';

$cssfile =
(stristr($_SERVER['HTTP_USER_AGENT'],'msie'))?'ie.css':'ff.c ss';

Note the new ] that was missing.

You owe me a beer.

Re: (REPOST) What"s wrong with this code?

am 16.04.2008 18:01:04 von AlmostBob

; end of line


"Preventer of Work" wrote in message
news:ExrMj.178480$pM4.48912@pd7urf1no...
> Ronald Raygun wrote:
>>
>> >> $cssfile =
>> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>> echo
>> "
>>
>> >> />
>> This is a test
>>
>> Hello world!
>>



>> " ; // the semi colon goes here dooesnt it?




>> ?>
>>
>>
>> The result in the browser is still:
>>
>> Hello world! " ?>
>>
>> - am I missing something?
>>
>>
>>
>>
>
> Compare:
>
> $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>
> $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT'],'msie'))?'ie.css':'ff.c ss';
>
> Note the new ] that was missing.
>
> You owe me a beer.

Re: (REPOST) What"s wrong with this code?

am 16.04.2008 18:01:04 von AlmostBob

; end of line


"Preventer of Work" wrote in message
news:ExrMj.178480$pM4.48912@pd7urf1no...
> Ronald Raygun wrote:
>>
>> >> $cssfile =
>> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>> echo
>> "
>>
>> >> />
>> This is a test
>>
>> Hello world!
>>



>> " ; // the semi colon goes here dooesnt it?




>> ?>
>>
>>
>> The result in the browser is still:
>>
>> Hello world! " ?>
>>
>> - am I missing something?
>>
>>
>>
>>
>
> Compare:
>
> $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>
> $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT'],'msie'))?'ie.css':'ff.c ss';
>
> Note the new ] that was missing.
>
> You owe me a beer.

Re: (REPOST) What"s wrong with this code?

am 17.04.2008 01:25:43 von Preventer of Work

AlmostBob wrote:
> ; end of line


That means he owes us each a beer.

>
>
> "Preventer of Work" wrote in message
> news:ExrMj.178480$pM4.48912@pd7urf1no...
>> Ronald Raygun wrote:
>>> >>> $cssfile =
>>> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>>> echo
>>> "
>>>
>>> >>> />
>>> This is a test
>>>
>>> Hello world!
>>>
>
>
>
>>> " ; // the semi colon goes here dooesnt it?
>
>
>
>
>>> ?>
>>>
>>>
>>> The result in the browser is still:
>>>
>>> Hello world! " ?>
>>>
>>> - am I missing something?
>>>
>>>
>>>
>>>
>> Compare:
>>
>> $cssfile =
>> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>>
>> $cssfile =
>> (stristr($_SERVER['HTTP_USER_AGENT'],'msie'))?'ie.css':'ff.c ss';
>>
>> Note the new ] that was missing.
>>
>> You owe me a beer.
>
>

Re: (REPOST) What"s wrong with this code?

am 17.04.2008 01:25:43 von Preventer of Work

AlmostBob wrote:
> ; end of line


That means he owes us each a beer.

>
>
> "Preventer of Work" wrote in message
> news:ExrMj.178480$pM4.48912@pd7urf1no...
>> Ronald Raygun wrote:
>>> >>> $cssfile =
>>> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>>> echo
>>> "
>>>
>>> >>> />
>>> This is a test
>>>
>>> Hello world!
>>>
>
>
>
>>> " ; // the semi colon goes here dooesnt it?
>
>
>
>
>>> ?>
>>>
>>>
>>> The result in the browser is still:
>>>
>>> Hello world! " ?>
>>>
>>> - am I missing something?
>>>
>>>
>>>
>>>
>> Compare:
>>
>> $cssfile =
>> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>>
>> $cssfile =
>> (stristr($_SERVER['HTTP_USER_AGENT'],'msie'))?'ie.css':'ff.c ss';
>>
>> Note the new ] that was missing.
>>
>> You owe me a beer.
>
>