Jump to content


Photo

One config file, please help


  • Please log in to reply
2 replies to this topic

#1 Guteman

Guteman
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts
  • LocationWisconsin

Posted 21 May 2006 - 04:51 AM

I am having an issue. I am creating a website with a number of directories. I want to have it so I only have 1 config file in a designated config directory. When im in my admin directory and I want to include my config file, it wont work unless I copy and paste the config.php into the admin directory. I only want 1 config file. What do I need todo to make this work like it should. I cant seem to find any tutorial on this.

Thanks,
Guteman

#2 ShibSta

ShibSta
  • Members
  • PipPipPip
  • Advanced Member
  • 112 posts

Posted 21 May 2006 - 05:00 AM

If your folders were like so:
Root
-admin
--admin.php
-config
-images
index.php

And you were in the admin.php, for example you would do:
<?php
include("../config/config.php");
?>

Hope that helps...
Each time you go up a directory just use ../ as a prefix...
If you had:
Root
-admin
--template
---header.tpl
-config
-images
index.php

And you wanted to include the config file in your admin header.tpl you'd do this:
<?php
include("../../config/config.php");
?>


#3 Guteman

Guteman
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts
  • LocationWisconsin

Posted 21 May 2006 - 06:12 AM

Hey I knew there was an easy way todo this, thanks!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users