PDA

Click to See Complete Forum and Search --> : What's the equivalent of ASPs' Application object?


Dodger
Oct 27th, 2002, 02:20 AM
see subject line.

TIA.

The Hobo
Oct 27th, 2002, 10:14 AM
If I knew what the Application Object was, perhaps I could help you?

Dodger
Oct 27th, 2002, 10:41 AM
It's used to store variables and objects etc. that can be accessed via any page anytime.

I need something that I can use to store 'settings' for an application in.

Eg:
Database = "DB1"
bgColor = "#COCOCO"
Font = "Verdana, Arial"

...and then access it in any page without having to set the values again.

This confusing?

Similar to autoglobals??

TIA.

Dodger
Oct 27th, 2002, 10:43 AM
...a globally accessable associative array.

phpman
Oct 29th, 2002, 09:37 AM
it called putting them into a file and using them.

$bgColor = "#COCOCO"


echo"<td bgcoor=".$bgColor.">somedata here </td>";

just like that.

The Hobo
Oct 29th, 2002, 10:30 AM
I just make a file, like config.php, and have that file set up an array like:

$CONFIG['bgColor'] = 'blah';
$CONFIG['database'] = 'db1';

and then call it on each page:

include 'config.php';

echo $CONFIG['bgColor'];

Dodger
Oct 29th, 2002, 11:10 AM
Thanks Guys! ;)

Dodger
Nov 16th, 2002, 01:27 PM
...But, doesn't it take up a lot of memory having to load the whole page of variables on every page?

Also, is there an easy way to modify those variables via code?

Kind Regards, Dodger.

The Hobo
Nov 16th, 2002, 11:03 PM
No, it doesn't take up much memory, unless you have a 1.3tb file (old joke, ignore it).

There would be no way to change it permenantly. You could always change it for the time being, but you'd have to either 1) write over the file with the new values, which would mean you'd have to chmod a few things. or 2) store them in a mysql database and update it as needed.