Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 785397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:52:17+00:00 2026-05-14T20:52:17+00:00

All, I have a config xml file in the following format: <?xml version=1.0?> <configdata>

  • 0

All,

I have a config xml file in the following format:

<?xml version="1.0"?>
<configdata>
    <development>
        <siteTitle>You are doing Development</siteTitle>
    </development>
    <test extends="development">
        <siteTitle>You are doing Testing</siteTitle>
    </test>
    <production extends="development">
        <siteTitle>You are in Production</siteTitle>
    </production>
</configdata>

To read this config file to apply environment settings, currently I am using, the following code in index.php file:

$appEnvironment = "production";
$config = new Zend_Config_Xml('/config/settings.xml', $appEnvironment );

To deploy this code on multiple environments, as user has to change index.php file. Instead of doing that, is it possible to maintain an attribute in the xml file, “say active=true”. Based on which the Zend_Config_Xml will know which section of the xml file settings to read?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:52:18+00:00Added an answer on May 14, 2026 at 8:52 pm

    If you’re using Zend Framework, I highly suggest you just use the APPLICATION_ENV constant that’s defined in Zend Application’s default index.php. If you’re not, you could probably do this regardless.

    // Define application environment
    defined('APPLICATION_ENV')
        || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
    

    It corresponds to your the environmental variable set in your site’s .htaccess file:

    //.htaccess
    SetEnv APPLICATION_ENV development
    

    You could then load your config file like so:

    $config = new Zend_Config_Xml('/config/settings.xml', APPLICATION_ENV );
    

    Then to switch environments, all that needs to be done is switch the value in the .htaccess file. On my server, I have my deployment script set up to automatically switch the value based on which environment I’m deploying to:

    $ sed -i 's/development/production/' /path/to/site/root/.htaccess
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a navigation.xml file: <?xml version=1.0 encoding=UTF-8?> <config> <nav> <programm_nav> <label></label> <uri>#</uri> <pages>
I have a need to have a config.xml file in my Eclipse project, and
Hi I have the following class which provides access to a xml file: public
I have defined a custom section in the App.config file and all the Configuration
I have a very short (so far), very basic XML file called config.xml like
In Linux, say I have the following file (e.g. conf.properties): HOST_URL=http://$HOSTNAME STD_CONFIG=http://$HOSTNAME/config USER_CONFIG=http://$HOSTNAME/config/$unconfigured I
in my config.php where i have all constants i set the PATH to a
All of our applications have Debug=False in the web.config and Release DLL's. We have
I'm writing in C# and trying to represent an XML config file through an
i have the following Problem - first of all i'm totally new to Flex.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.