hi,
this is deepak, i got stuck in a script where i want to apply a platform specific css. i will be greatful if anyone could help me out.
My PHP code is:
[code=php]
<?php
$agent = getenv("HTTP_US ER_AGENT");
if (preg_match("/Win/i", "$agent")){
$style = "win";
//echo "matched window";
}else if (preg_match("/Linux/", "$agent")){
$style = "linux";
//echo "matched linux";
}
$win_style = "
<style1 type = \"text/css\">\n
p, ul, ol, li {font family:Arial;fo nt-size:20pt;font-weight:normal;} \n
h1 {font family:Arial;fo nt-size:16pt;font-weight:bold;}\n
h2 {font family:Arial;fo nt-size:14pt;font-weight:bold;}\n
strong {font family:Arial;fo nt-size:10pt;font-weight:bold;}\n
em {font family:Arial;fo nt-size:10pt;font-style:italic;}\ n
</style1>
";
$linux_style = "
<style1 type = \"text/css\">\n
p, ul, ol, li {font family:Times;fo nt-size:10pt;font-weight:normal;} \n
h1 {font family:Times;fo nt-size:18pt;font-weight:bold;}\n
h2 {font family:Times;fo nt-size:16pt;font-weight:bold;}\n
strong {font family:Times;fo nt-size:12pt;font-weight:bold;}\n
em {font family:Times;fo nt-size:12pt;font-style:italic;}\ n
</style1>
";
?>
<html>
<head>
<title>Platfo rm Matching</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?
if($style == "win"){
echo "$win_style ";
$style = "$win_style ";
}else if($style == "linux"){
echo "$linux_sty le";
$style = "$linux_sty le";
}
?>
<h1 align=center> This is a level 1 heading </h1>
<h2 align=center> Look! a level 2 heading</h2>
<p align=center> this a simple paragraph with some <strong> bold </strong> and <em> emphasized</em> text.</p>
</body>
</html>
[/code]
this is deepak, i got stuck in a script where i want to apply a platform specific css. i will be greatful if anyone could help me out.
My PHP code is:
[code=php]
<?php
$agent = getenv("HTTP_US ER_AGENT");
if (preg_match("/Win/i", "$agent")){
$style = "win";
//echo "matched window";
}else if (preg_match("/Linux/", "$agent")){
$style = "linux";
//echo "matched linux";
}
$win_style = "
<style1 type = \"text/css\">\n
p, ul, ol, li {font family:Arial;fo nt-size:20pt;font-weight:normal;} \n
h1 {font family:Arial;fo nt-size:16pt;font-weight:bold;}\n
h2 {font family:Arial;fo nt-size:14pt;font-weight:bold;}\n
strong {font family:Arial;fo nt-size:10pt;font-weight:bold;}\n
em {font family:Arial;fo nt-size:10pt;font-style:italic;}\ n
</style1>
";
$linux_style = "
<style1 type = \"text/css\">\n
p, ul, ol, li {font family:Times;fo nt-size:10pt;font-weight:normal;} \n
h1 {font family:Times;fo nt-size:18pt;font-weight:bold;}\n
h2 {font family:Times;fo nt-size:16pt;font-weight:bold;}\n
strong {font family:Times;fo nt-size:12pt;font-weight:bold;}\n
em {font family:Times;fo nt-size:12pt;font-style:italic;}\ n
</style1>
";
?>
<html>
<head>
<title>Platfo rm Matching</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?
if($style == "win"){
echo "$win_style ";
$style = "$win_style ";
}else if($style == "linux"){
echo "$linux_sty le";
$style = "$linux_sty le";
}
?>
<h1 align=center> This is a level 1 heading </h1>
<h2 align=center> Look! a level 2 heading</h2>
<p align=center> this a simple paragraph with some <strong> bold </strong> and <em> emphasized</em> text.</p>
</body>
</html>
[/code]
Comment