[SOLVED] Calling config

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Calling config

Post by pinehead18 »

I've created a config file. $config['header_table'] = "#FFFFFF"; is one of the examples.

Now, when i include the config.inc.php onto index.php and try to pull that config with the following code it does not work


<table border=0 bgcolor=<?php echo $config['header_table']; ?>>

it does not work.

Any ideas?

Am i including it wrong? Am i not creating the config file right'?

Thank you
Anthony
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Just a question. But are you using include("config.php"); :P
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post by pinehead18 »

my config file is config.inc.php and my functions file is functions.inc.php

my functions file contains require('config.inc.php');

then my header file contains

require('functions.inc.php');

then my index.php file contains require('html.inc.php');

Thank you
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

I personally think you must be declaring something in config.inc.php wrong as your code seems fine to me. As a test try:

$header_table = "#FFFFFF";

instead of:

$config['header_table'];

just to see if it works. :P
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post by pinehead18 »

Thanks for your help, it seems it was my fault. For some reason i had a space between $config and [header_table]

If it wasn't for you suggesting to try it without $config iw ould have not figured it out htis morning lol
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

NP, Happy coding ;)
Post Reply