View Single Post
Old 08-20-2006, 06:54 AM   · #1
Barrucadu
Formally Mikor.
 
Barrucadu's Avatar
 
Name: Michael Walker
Location: East Yorkshire, England
Trader Rating: (7)
Join Date: Aug 2005
Posts: 2,546
NP$: 171.25 (Donate)
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
A handy bit of code

Lets say, you let each user choose a theme, and the url of the css for that theme was stored in a database. If you are using dreamweaver and want your pages to look nice (ie: WITH a style sheet) while you edit them, use this code.

PHP Code:
<?php
if(1 == 2){
?>
<head>
<link rel="stylesheet" href="default.css" type="text/css" />
</head>
<?php
}else{
     echo
'<head>
     <link rel="stylesheet" href="'
. $url_to_stylesheet . '" type="text/css" />
     </head>'
;
}
?>


How this works is:
1) Dreamweaver sees the HTML and renders it.
2) The PHP parser sees the if statement if(1 == 2), 1 does not equal 2, so the html is not rendered.
3) Because 1 does not equal 2, the alternate style sheet is used instead.

Basicly, it uses your stylesheet when your editing it in dreamweaver, but another stylesheet when online.


Please register or log-in into NamePros to hide ads
__________________
Me | Last.fm | F@h | Archlinux.co.uk

archlinux User
Barrucadu is offline   Reply With Quote
Site Sponsors
YUPPADS Hunting Moon Buy Flash Arcade Game Script
Advertise your business at NamePros
All times are GMT -7. The time now is 11:47 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.