Forum Moderators: coopster

Message Too Old, No Replies

Checking if settings are loaded

         

Francis

10:03 am on Sep 19, 2003 (gmt 0)

10+ Year Member



Can PHP check if settings are already loaded?

For example, I have site-specific-settings.php and have already loaded it into the home.php. Then, when I go to another page, say another.php, I want to check if the settings are already loaded, if not, then load them, otherwise, just display the page.

Is this possible? Or any alternatives?

I asked because I have a header.php, and menu.php which can be called from any directory level, thus, I defined it as:

define ("ROOT_SITE", "http://dir1/").

and call the graphics as
<?php echo(ROOT_SITE)?>images/image1.jpg

However, when I move to another page, or call the page by itself from the browser, I get an error.

mogwai

11:59 am on Sep 19, 2003 (gmt 0)

10+ Year Member



Sounds like you need to use sessions.

[uk.php.net...]

coopster

12:02 pm on Sep 19, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Francis, HTTP is a stateless protocol -- a client requests information from a server, the server processes the request, sends the information back to the client and disconnects. Any variables are no longer "in memory". If you want to use variables from page to page, or during a client-server "session", you'll need to employ a form of state or session management. This is where you start learning about passing variables through hidden fields, cookies, PHP session-management, etc.

Francis

6:47 am on Sep 23, 2003 (gmt 0)

10+ Year Member



Thanks a lot guys....

Will do look it up