Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

sqldatasource dal, wwwxxxenden, convert raid5 to raid 10 mdadm, apache force chunked, nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas, linux raid resync after reboot

Links

XODOX
Impressum

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

Posted on 2008-04-11 09:05:39 by Ronald Raygun

<?php
$cssfile =
(stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
echo
"<html>
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\" />
<title>This is a test</title>
</head>
<body>Hello world!
</body>
</html>"
?>


The result in the browser is still:

Hello world! " ?>

- am I missing something?

Report this message

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

Posted on 2008-04-11 09:16:56 by Lars Eighner

In our last episode, <VYGdnWndgNVkkGLanZ2dnUVZ8q_inZ2d@bt.com>, the lovely
and talented Ronald Raygun broadcast on comp.lang.php:


><?php
> $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "<html>
> <head>
> <link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\" />
> <title>This is a test</title>
> </head>
> <body>Hello world!
> </body>
> </html>"
> ?>


> 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 <http://larseighner.com/> usenet@larseighner.com
Countdown: 284 days to go.

Report this message

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

Posted on 2008-04-11 09:16:56 by Lars Eighner

In our last episode, <VYGdnWndgNVkkGLanZ2dnUVZ8q_inZ2d@bt.com>, the lovely
and talented Ronald Raygun broadcast on comp.lang.php:


><?php
> $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "<html>
> <head>
> <link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\" />
> <title>This is a test</title>
> </head>
> <body>Hello world!
> </body>
> </html>"
> ?>


> 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 <http://larseighner.com/> usenet@larseighner.com
Countdown: 284 days to go.

Report this message

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

Posted on 2008-04-11 09:20:58 by Erwin Moller

Ronald Raygun schreef:
>
> <?php
> $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "<html>
> <head>
> <link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\" />
> <title>This is a test</title>
> </head>
> <body>Hello world!
> </body>
> </html>"
> ?>
>
>
> 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

Report this message

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

Posted on 2008-04-11 09:20:58 by Erwin Moller

Ronald Raygun schreef:
>
> <?php
> $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "<html>
> <head>
> <link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\" />
> <title>This is a test</title>
> </head>
> <body>Hello world!
> </body>
> </html>"
> ?>
>
>
> 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

Report this message

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

Posted on 2008-04-11 20:21:40 by luiheidsgoeroe

On Fri, 11 Apr 2008 09:05:39 +0200, Ronald Raygun <invalid@domain.com> =

wrote:

>
> <?php
> $cssfile =3D =

> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "<html>
> <head>
> <link rel=3D\"stylesheet\" type=3D\"text/css\" =

> href=3D\"$cssfile\" />
> <title>This is a test</title>
> </head>
> <body>Hello world!
> </body>
> </html>"
> ?>
>
>
> 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

Report this message

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

Posted on 2008-04-12 02:24:32 by spam

"Ronald Raygun" <invalid@domain.com> wrote in message
news:VYGdnWndgNVkkGLanZ2dnUVZ8q_inZ2d@bt.com...
>
> <?php
> $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
> "<html>
> <head>
> <link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\"
/>
> <title>This is a test</title>
> </head>
> <body>Hello world!
> </body>
> </html>"
^ Missing semicolon.
> ?>
>
>
> The result in the browser is still:
>
> Hello world! " ?>
>
> - am I missing something?

Report this message

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

Posted on 2008-04-12 02:24:32 by spam

"Ronald Raygun" <invalid@domain.com> wrote in message
news:VYGdnWndgNVkkGLanZ2dnUVZ8q_inZ2d@bt.com...
>
> <?php
> $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
> "<html>
> <head>
> <link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\"
/>
> <title>This is a test</title>
> </head>
> <body>Hello world!
> </body>
> </html>"
^ Missing semicolon.
> ?>
>
>
> The result in the browser is still:
>
> Hello world! " ?>
>
> - am I missing something?

Report this message

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

Posted on 2008-04-13 12:11:05 by Andrew Bailey

"Ronald Raygun" <invalid@domain.com> wrote in message
news:VYGdnWndgNVkkGLanZ2dnUVZ8q_inZ2d@bt.com...
>
> <?php
> $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "<html>
> <head>
> <link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\"
> />
> <title>This is a test</title>
> </head>
> <body>Hello world!
> </body>
> </html>"
> ?>
>
>
> The result in the browser is still:
>
> Hello world! " ?>
>
> - am I missing something?
>
>
>
>

FWIW I would use...

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

<html>
<head>
<link rel="stylesheet" type="text/css" href="<?php echo
$cssfile;?>">
<title>This is a test</title>
</head>
<body>Hello world!
</body>
</html>
?>

Andy

Report this message

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

Posted on 2008-04-13 12:11:05 by Andrew Bailey

"Ronald Raygun" <invalid@domain.com> wrote in message
news:VYGdnWndgNVkkGLanZ2dnUVZ8q_inZ2d@bt.com...
>
> <?php
> $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "<html>
> <head>
> <link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\"
> />
> <title>This is a test</title>
> </head>
> <body>Hello world!
> </body>
> </html>"
> ?>
>
>
> The result in the browser is still:
>
> Hello world! " ?>
>
> - am I missing something?
>
>
>
>

FWIW I would use...

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

<html>
<head>
<link rel="stylesheet" type="text/css" href="<?php echo
$cssfile;?>">
<title>This is a test</title>
</head>
<body>Hello world!
</body>
</html>
?>

Andy

Report this message

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

Posted on 2008-04-13 17:05:24 by lws4art

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



--
Take care,

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

Report this message

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

Posted on 2008-04-13 17:05:24 by lws4art

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



--
Take care,

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

Report this message

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

Posted on 2008-04-13 19:37:40 by Preventer of Work

Ronald Raygun wrote:
>
> <?php
> $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "<html>
> <head>
> <link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\" />
> <title>This is a test</title>
> </head>
> <body>Hello world!
> </body>
> </html>"
> ?>
>
>
> 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.

Report this message

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

Posted on 2008-04-13 19:37:40 by Preventer of Work

Ronald Raygun wrote:
>
> <?php
> $cssfile =
> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
> echo
> "<html>
> <head>
> <link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\" />
> <title>This is a test</title>
> </head>
> <body>Hello world!
> </body>
> </html>"
> ?>
>
>
> 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.

Report this message

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

Posted on 2008-04-16 18:01:04 by AlmostBob

; end of line


"Preventer of Work" <not_this@nospam.xxx> wrote in message
news:ExrMj.178480$pM4.48912@pd7urf1no...
> Ronald Raygun wrote:
>>
>> <?php
>> $cssfile =
>> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>> echo
>> "<html>
>> <head>
>> <link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\"
>> />
>> <title>This is a test</title>
>> </head>
>> <body>Hello world!
>> </body>



>> </html>" ; // 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.

Report this message

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

Posted on 2008-04-16 18:01:04 by AlmostBob

; end of line


"Preventer of Work" <not_this@nospam.xxx> wrote in message
news:ExrMj.178480$pM4.48912@pd7urf1no...
> Ronald Raygun wrote:
>>
>> <?php
>> $cssfile =
>> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>> echo
>> "<html>
>> <head>
>> <link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\"
>> />
>> <title>This is a test</title>
>> </head>
>> <body>Hello world!
>> </body>



>> </html>" ; // 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.

Report this message

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

Posted on 2008-04-17 01:25:43 by Preventer of Work

AlmostBob wrote:
> ; end of line


That means he owes us each a beer.

>
>
> "Preventer of Work" <not_this@nospam.xxx> wrote in message
> news:ExrMj.178480$pM4.48912@pd7urf1no...
>> Ronald Raygun wrote:
>>> <?php
>>> $cssfile =
>>> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>>> echo
>>> "<html>
>>> <head>
>>> <link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\"
>>> />
>>> <title>This is a test</title>
>>> </head>
>>> <body>Hello world!
>>> </body>
>
>
>
>>> </html>" ; // 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.
>
>

Report this message

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

Posted on 2008-04-17 01:25:43 by Preventer of Work

AlmostBob wrote:
> ; end of line


That means he owes us each a beer.

>
>
> "Preventer of Work" <not_this@nospam.xxx> wrote in message
> news:ExrMj.178480$pM4.48912@pd7urf1no...
>> Ronald Raygun wrote:
>>> <?php
>>> $cssfile =
>>> (stristr($_SERVER['HTTP_USER_AGENT','msie'))?'ie.css':'ff.cs s';
>>> echo
>>> "<html>
>>> <head>
>>> <link rel=\"stylesheet\" type=\"text/css\" href=\"$cssfile\"
>>> />
>>> <title>This is a test</title>
>>> </head>
>>> <body>Hello world!
>>> </body>
>
>
>
>>> </html>" ; // 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.
>
>

Report this message