Config File

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

Config File

Post by pinehead18 »

I'm wanting to create a config file for my site, and for like my mysql user pass and db's. However, i'm kinda lost attempting to do it.

I thought it was $config['var'] = "Table color or whatever";

Then i includ ethe config file corect? Well my question is, when i am on my individual pages.. How do i call that var.. IE>

<table border="0" backgroundcolor="$config['var']" > ???

Thank you
Anthony
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

<table border="0" backgroundcolor="$config['var']" >
well.. if that's in an echo, i.e.

Code: Select all

<?php
echo "<table border="0" backgroundcolor="{$config['var']}" >"; // or
echo '<table border="0" backgroundcolor="'.$config['var'].'" >'; // there are plenty of other ways..
?>
if it's an include:

Code: Select all

<?php ?>
<table border="0" backgroundcolor="<?php echo $config['var'] ?>" >
is the most compliant of these forms...
Post Reply