Announcement

Collapse
No announcement yet.

variables.php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    variables.php

    Hi all,

    This isn't specifically intended for use actinic...

    I'd like to have a single file that houses variables. Things like HOURLY_RATE, PHONE_NUMBER, HEADLINE etc

    then instead of writing the hourly rate on every page I could just call the file once per page and then call the variables wherever I wanted them.

    I've done lots of googling and I know this is possible with php. My main problem is with accessing the variable from another file. For my example, i'd like to put the variables in "../assets/variables.php"

    I'm sure I'll kick myself when I see this!
    Thanks very much

    Matt
    http://www.itwiz.co.uk

    http://www.AntiV.net - The Discount Antivirus Store

    #2
    Originally posted by mattc View Post
    Hi all,

    This isn't specifically intended for use actinic...

    I'd like to have a single file that houses variables. Things like HOURLY_RATE, PHONE_NUMBER, HEADLINE etc

    then instead of writing the hourly rate on every page I could just call the file once per page and then call the variables wherever I wanted them.

    I've done lots of googling and I know this is possible with php. My main problem is with accessing the variable from another file. For my example, i'd like to put the variables in "../assets/variables.php"

    I'm sure I'll kick myself when I see this!
    Thanks very much

    Matt
    What you describe can be done by using PHP includes whereby you include the file on each page you will be calling the variable (though in this instance I would call them "constants") by adding similar code to this

    HTML Code:
    <?php include('includes/constants.inc.php');  ?>
    at the top of each page or where you will actually be calling the constant

    further info on includes here
    The Pretty Dress Company

    Comment


      #3
      yep big kick!

      Thanks for your help
      http://www.itwiz.co.uk

      http://www.AntiV.net - The Discount Antivirus Store

      Comment

      Working...
      X