Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
How do you use css with php?
Old 06-02-2008, 10:18 PM How do you use css with php?
scutari's Avatar
Skilled Talker

Posts: 95
Name: Indrit
Trades: 0
Well this is important, I just can combine html and css perfectly. Php is kinda difficult to adapt with css.
What do you do?
__________________

Please login or register to view this content. Registration is FREE
scutari is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-02-2008, 10:24 PM Re: How do you use css with php?
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
I have never had any problem. HTML and CSS embed well in PHP. Can you be more specific?
joder is offline
Reply With Quote
View Public Profile
 
Old 06-02-2008, 10:32 PM Re: How do you use css with php?
scutari's Avatar
Skilled Talker

Posts: 95
Name: Indrit
Trades: 0
I mean if you use divs or how do you embed css with echo command?
__________________

Please login or register to view this content. Registration is FREE
scutari is offline
Reply With Quote
View Public Profile
 
Old 06-02-2008, 10:44 PM Re: How do you use css with php?
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
The parts of a page you use html just use html and only use php for the parts that contain php - putting the <?php ?> tags around them.

To use HTML or CSS in PHP sections you echo it and the HTML looks almost exactly like in HTML pages. The difference is double quotes have to be escaped with a backslash (\).

http://www.tizag.com/phpT/echo.php
joder is offline
Reply With Quote
View Public Profile
 
Old 06-02-2008, 10:46 PM Re: How do you use css with php?
Capt Quirk's Avatar
Extreme Talker

Posts: 223
Location: Flordidian
Trades: 0
I'm playing with this now. I created all the divs, and lined them up with css. Then I create the content of the div as the php. Probably not the preferred method, but it works. Once the php is brought in, it will follow the css that is attached to the page. I think..hehehe.
Capt Quirk is offline
Reply With Quote
View Public Profile
 
Old 06-02-2008, 11:59 PM Re: How do you use css with php?
Arenlor's Avatar
Ultra Talker

Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
PHP is PHP Hypertext Preprocessor. Your PHP code is processed on your server and served to the client as HTML only. They never will nor can see your code. You use HTML/CSS in exactly the same way as usual, you just do something else before the HTML is sent and then processed by the agent. I'd suggest just using external stylesheets though, it's easiest.
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 06-03-2008, 02:13 PM Re: How do you use css with php?
Average Talker

Posts: 26
Name: Andy
Trades: -1
You should be applying style markuping in a separate CSS file, rather than inline with <div style="ladeda"> as you seem to be suggesting.

That said, there is no reason for anything not to work with PHP - just make sure you are properly escaping your ' and "s with a \.
Pash is offline
Reply With Quote
View Public Profile
 
Old 06-03-2008, 05:19 PM Re: How do you use css with php?
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
In order to parse a .php file as CSS, you simply put this line at the top of the page:
PHP Code:
<?php header("Content-type: text/css"); ?>
Now you can link to link to the .php file as if it was a CSS file, and insert dynamic content into it. Not sure if this is what you're looking for, but it may come in handy.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 06-04-2008, 01:37 AM Re: How do you use css with php?
Arenlor's Avatar
Ultra Talker

Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
Quote:
Originally Posted by Pash View Post
You should be applying style markuping in a separate CSS file, rather than inline with <div style="ladeda"> as you seem to be suggesting.

That said, there is no reason for anything not to work with PHP - just make sure you are properly escaping your ' and "s with a \.
Not should but can. If you know anything about CSS you will know that there are very good reasons for inline CSS. It's very specific, which means it'll override pretty much anything else (though I think !important may be able to override it). An internal stylesheet (contained in the header) is the next level up, while external stylesheets, which are meant to be shared between several pages, and therefore shouldn't be used if only one page is using it, rather use internal, are on the lowest end. So say you have in an external stylesheet body{background:#000000;}, which is used on pages A, B, and C. Pages A and B though both have internal stylesheets which have body {background:#FFFFFF;} and page A has style="background:#A0A0A0;" on its body tag. Page A would have the gray background (#A0A0A0), page B would have white (#FFFFFF) and page C would have black (#000000). PHP works with all three methods just like any HTML does.
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Reply     « Reply to How do you use css with php?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.69517 seconds with 12 queries