Page 1 of 1

applying css to php results?

Posted: Thu Apr 08, 2004 4:26 pm
by saviiour
I was curious. On one of my pages, i have an inlcude statement that links to a txt file.

Now iam creating a css file for my website. Is there a way to apply css to the result that comes out of that txt file?

Posted: Thu Apr 08, 2004 4:33 pm
by PrObLeM
I think this will help

Code: Select all

<td class="really cool"><?php include("stuff.txt"); ?></td>

Posted: Thu Apr 08, 2004 5:00 pm
by saviiour
so i just make a selector by the name of "really cool"

and add the css tag in the txt file

<link rel="stylesheet" href="lo.css" type="text/css">

Posted: Thu Apr 08, 2004 6:24 pm
by d3ad1ysp0rk
If you include something into your current page it'll get formatted the same as the rest of the text.

Code: Select all

<?php
echo "<html><body>";
echo "<font color=#CCCCCC face=verdana>text";
include("file.txt");
echo "</font></body></html>";
?>
It'll all get formatted with grey, verdana font.

Posted: Fri Apr 09, 2004 3:11 pm
by twigletmac
ikk, font tags...

Mac

Posted: Fri Apr 09, 2004 3:59 pm
by Unipus
Also, anything in that text file will get interpreted first as PHP and then as HTML. So you can write tags, classes, etc. into that text file itself and it will all style appropriately when included (assuming those classes are defined already).

Yes, big ick to font tags.

And, spaces in class names are a BAD BAD idea. So bad that they totally won't work. Underscores are also supposedly a no-no, although they will frequently work. hyphens and studlyCaps are the best way to go.

Posted: Sat Apr 10, 2004 8:14 pm
by Buddha443556
Unipus wrote:And, spaces in class names are a BAD BAD idea. So bad that they totally won't work. Underscores are also supposedly a no-no, although they will frequently work. hyphens and studlyCaps are the best way to go.
I thought PrObLeM was referring to two different classes? Hmmm...