Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2008
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Mixing design with php files

    Hey Y'all,

    If I wanted to design a web page, do you prefer creating a separate CSS file or making like a header.php or footer.php file?

  • #2
    Regular Coder FWDrew's Avatar
    Join Date
    Apr 2008
    Location
    Missouri
    Posts
    380
    Thanks
    38
    Thanked 45 Times in 43 Posts
    Quote Originally Posted by wiseguy89 View Post
    Hey Y'all,

    If I wanted to design a web page, do you prefer creating a separate CSS file or making like a header.php or footer.php file?
    Yes.

    The question is confusing. An external CSS file is pretty much a must and will contain all the styling and display aspects of the page.

    PHP is a server side programming language. The include() function in PHP would be helpful and is used quite often for things like the header and footer.

    It might help to research a little into CSS and PHP so you can see the difference between the two and how to use them to enhance your web page

    Drew

  • #3
    New Coder
    Join Date
    Mar 2008
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    okay so one CSS file can layout the entire page? how would you know where to insert the php files in the design?

  • #4
    Regular Coder
    Join Date
    Jan 2008
    Location
    Geneva, Switzerland
    Posts
    413
    Thanks
    12
    Thanked 29 Times in 29 Posts
    One CSS can layout your whole website or parts of it - this depends on what you want to achieve.

    Where to insert the PHP files?
    - What is your PHP code doing? If your code should display something to the visitor, then place it in your HTML code at the place where you want the PHP output to be displayed, separating it from your HTML code using <? ... ?>

    Otherwise, your PHP code can simply be placed at the top of your pages, or anywhere else. Code is always executed from top to bottom...

    You should check a few basic tutorials on how to combine HTML, CSS and PHP together.
    Chuck Norris counted to infinity.
    Twice.

  • #5
    Regular Coder
    Join Date
    Sep 2007
    Location
    Grahamstown, South Africa
    Posts
    237
    Thanks
    6
    Thanked 17 Times in 17 Posts
    honestly... cant people look through a couple of tutorials before asking tedious & pointless questions?

    That was rhetorical, and no offence intended.

    CSS-> contains style elements.
    Include-> contains something generic about your website.

    Normally an include would contain PHP code, but in this case we'd make it just plain HTML.
    SO, if you want a line at the top of your website:
    <hr> -> that would be in a file called header.php.

    Now you want two lines: so you do this->
    <hr><hr>

    Now the changes will be generic, that is wherever you included the file: ie->
    PHP Code:
    <?php include("header.php"); ?>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •