Jump to content

One config file, please help


Guteman

Recommended Posts

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
Link to comment
Share on other sites

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:
[code]<?php
include("../config/config.php");
?>[/code]

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:
[code]<?php
include("../../config/config.php");
?>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.