Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Apply CSS on PHP output?
01-15-2008, 12:27 AM #1
- Join Date
- Jan 2008
- Thanked 0 Times in 0 Posts
Apply CSS on PHP output?
How can I apply css on my output like tables and colors, bold ,align, etc...
like I want to apply style to the colored section:
here is the code:
01-15-2008, 01:38 AM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,659 Times in 2,628 Posts
I don't understand the problem you are having, this is the correct idea (haven't gone through the code line by line though...).
You have php that is populating html elements and applying the stylesheet to the elements. I see you are using your class in an list element, so it is applied (though the style can be combined into only one declaration). Watch your spelling as well, there is a 'java script:' in one of your calls which will not work. Also, your php calls from the inside of the code:
I would not recommend. This may not work on all servers for starters, and _SERVER['PHP_SELF'] superglobal is also susceptible to XSS injections. A better option would be:
<?php echo $_SERVER['SCRIPT_NAME'];?>
where the two changes are the short tags are removed (<?= to <?php echo) and the semi-colon added at the end (which I believe is required regardless of the method of call).
My final words are: don't develop using MS Office, it is not worth the headache. Although you have pulled it into xml/html code which is good, it will cause you headaches in the long run - especially since it tends to add garbage at the top of all your generated pages, and will kill a php script.
Oh, and I made this assumption which I should not have. I assume that your file has been saved with a .php extension and that you are running it on a host with php capabilities. This won't actually change the stylesheet usage on the page, but obviously it won't parse as php if you don't have these.
Hope that helps!
Hmm, maybe I've completely mistook what you are looking for. I didn't notice that you had no linked stylesheet before.
Assuming you have your stylesheet created (which I will not teach here, but the CSS forum will gladly help), you just link it into your HTML code's <head> tag like so:
<link rel="stylesheet" type="stylesheet" href="path/to/my/stylesheet.css" />
Where stylesheets generally have a .css extension.
Last edited by Fou-Lu; 01-15-2008 at 01:40 AM.
header('HTTP/1.1 420 Enhance Your Calm');