[advanced search]
Results from the most recent live auction are here.
24 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Domain Name Industry Newsletter
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

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
Old 09-07-2006, 05:42 AM   · #2
lepunk
Account Closed
 
Trader Rating: (2)
Join Date: Jan 2005
Posts: 139
NP$: 171.00 (Donate)
lepunk is an unknown quantity at this point
hehe! tricky code usefull if you are using dreamweaver...
...but I'm using notepad..or programmers notepad
lepunk is offline   Reply With Quote
Old 09-07-2006, 09:04 AM   · #3
ablaye
NamePros Regular
 
Location: WebmasterGround.com
Trader Rating: (0)
Join Date: May 2006
Posts: 825
NP$: 0.00 (Donate)
ablaye is on a distinguished road
Thanks for the code. Very useful indeed.
ablaye is offline   Reply With Quote
Old 09-08-2006, 11:48 AM   · #4
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
Originally Posted by lepunk
usefull if you are using dreamweaver...



Yup, I got bored of trying to edit big pages with no stylesheet, lol
__________________
Me | Last.fm | F@h | Archlinux.co.uk

archlinux User
Barrucadu is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


Site Sponsors
Proof is in the Parking Proof is in the Parking Proof is in the Parking
Advertise your business at NamePros
All times are GMT -7. The time now is 06:28 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0