This is a discussion on "CSS and PHP" within the PHP Forum section. This forum, and the thread "CSS and PHP are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
CSS and PHP
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
CSS and PHP
How do I insert css style sheets in php, and if the sylesteet has a fixed text body will the php stay in that area?
|
|
|
|
#2
|
|||
|
|||
|
Re: CSS and PHP
What? Are you trying to use PHP to dynamically add style sheets?
What exactly are you asking? |
|
#3
|
|||
|
|||
|
Re: CSS and PHP
How Do I Put Css in Php
|
|
#4
|
|||
|
|||
|
Re: CSS and PHP
I don't think you can actually style PHP. It's a programming language. What you can style is HTML that PHP outputs.
If your asking how to style the output from PHP then I think you'll have to post a better description of what your trying to do. Or maybe some code. Sorry if I'm still not getting what your trying to say here. |
|
#5
|
|||
|
|||
|
Re: CSS and PHP
Ok how do I put php in html
|
|
#6
|
|||
|
|||
|
Re: CSS and PHP
Em. Well. Something like this I guess...
If you understand PHP you can style your content dynamically as well by echoing classes and using variables sort of like how I have done above. |
|
#7
|
|||
|
|||
|
Re: CSS and PHP
As a convenience when wanting to embed values of variables within HTML, you can also use <?=
So instead of
you could write
If you get really keen on PHP and plan to use it for serious work then it's good practice to separate your business logic from presentation logic as much as possible. If database queries and other computational code is mixed in with the HTML code then it can make it much harder to maintain the codebase, and in the worst case, impossible. Spaghetti code also increases the probability of bugs and complicates debugging. Template systems such as Smarty can be helpful as can frameworks such as CakePHP. Most frameworks offer additional benefits to merely using templates by encouraging certain design practices and consistency, and they can also substantially reduce the amount of code that is required to be written. Last edited by ioncube; Aug 9th, 2007 at 13:40. |
![]() |
| Tags |
| css, php |
| Thread Tools | |
|
|