[thelist] PHP multiple style switcher

Dan Parry dan at virtuawebtech.co.uk
Sat Nov 24 09:36:25 CST 2007


> -----Original Message-----
> From: thelist-bounces at lists.evolt.org [mailto:thelist-
> bounces at lists.evolt.org] On Behalf Of DAVOUD TOHIDY
> Sent: 24 November 2007 15:18
> To: thelist at lists.evolt.org
> Subject: Re: [thelist] PHP multiple style switcher
> 
> 
> on Date: Sat, 24 Nov 2007 15:06:51 +0000 Dan parry wrote:
> > It means Hope This Helps :)
> thanks for explanation. I was confused. :)
> 
> o.k so what about the next section. That gets parse error too.
> 
> <?php
> break;
> default:
> ?>
> <link rel="stylesheet" type="text/css" media="screen"
> href="screen.css" />
> <!--[if lte IE 6]>
> <link href="css/IE6.css" rel="stylesheet" type="text/css"
> media="screen" />
> <![endif]-->
> <?php
> break;
> }
> ?><link rel="stylesheet" type="text/css" media="print" href="print.css"
> />
> 
> and have I understood the logic as I described in my previous posts?
> Sorry I am not a backend developer, so please forgive me
> if I am sking too much.

I've rewritten the entire code block from Jeffrey's post (the block posted
should indeed work, but my preference is to not mix <?php ?> and HTML
content in that respect)

<?php
   switch ($_GET['style']) {
      case 'hicontrast':
         echo '<link rel="stylesheet" type="text/css" media="screen"
href="hiC.css" /> <!--[if lte IE 6]> <link href="css/hiCIE6.css"
rel="stylesheet" type="text/css"  
				media="screen" />
				<![endif]-->';

         break;
      default:
         echo '<link rel="stylesheet" type="text/css" media="screen"
href="screen.css" /><!--[if lte IE 6]>
            <link href="css/IE6.css" rel="stylesheet" type="text/css"  
            media="screen" />
            <![endif]-->';
		 
		 break;
}
?>

If you need to add a case for, e.g., bigtext you simply add

case 'bigtext':
   echo 'This is where to put the LINK element';
   break;

I hope that goes some way to making sense

Dan

BTW, I've used single quotes to avoid having to escape the double quotes in
the string... Be sure to close the single quote and end the line with a ;

> regards,
> davoud
> 
> 
> _________________________________________________________________
> Are you ready for Windows Live Messenger Beta 8.5 ? Get the latest for
> free today!
> http://entertainment.sympatico.msn.ca/WindowsLiveMessenger
> --
> 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
> 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.16.5/1149 - Release Date:
> 24/11/2007 10:06
> 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.503 / Virus Database: 269.16.5/1149 - Release Date: 24/11/2007
10:06
 




More information about the thelist mailing list