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
    Regular Coder
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    120
    Thanks
    22
    Thanked 0 Times in 0 Posts

    Smile PHP Question<Head></Head>

    Hello.

    I would like to know on my index.php I have the main head section on that page but when I create new php pages I have to add it to them manually will not pick up the style sheets etc.

    How do I make this work so do not have to enter it all the time.

  2. #2
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,819
    Thanks
    12
    Thanked 393 Times in 390 Posts
    Use the PHP "include" function.

  3. #3
    Regular Coder
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    120
    Thanks
    22
    Thanked 0 Times in 0 Posts
    <?php include'common/header.php'; ?>

    at top which has main title in there but want one for each different page.

  4. #4
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    870
    Thanks
    24
    Thanked 100 Times in 100 Posts
    you can set variables in your header:

    in header.php:
    PHP Code:
    <title><?PHP echo $title?></title>
    in main file:
    PHP Code:
    <?php
    $title 
    'unique title';
     include
    'common/header.php'?>
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month

  5. #5
    Regular Coder
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    120
    Thanks
    22
    Thanked 0 Times in 0 Posts
    Thank you will give it a go just learning basic of php mostly know standard html working my way up the ladder.

    think best way is html, php, javascript, mysql


 

Tags for this Thread

Posting Permissions

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