I'm using Dreamweaver to publish my website to the web server. I have a php file called init.php that I include in my pages containing information relevant to connecting to my DB. The information is different depending on whether I'm running on my local test server or on the remote server. I would like to have a remote init.php and a local init.php and whenever I "put" my site from dreamweaver, I don't want the remote copy of init.php to be overwritten. How do I do this? Is there a special setting in dreamweaver?
Uploading with Dreamweaver CS5 +++++++++++++++++++++++++++++++++
Please see the details information to the link:
https://www2.suresupport.com/faq/17/470
Start your Dreamweaver CS5 program.
First you need to set up your local site. From the menu choose Site -> New site.
A Site Setup screen will open up. The first set of options is Site.
You will need to enter the following information:
Site Name: Here you can type whatever name you need to. It will be used as a title reference in the sites list in your Dreamweaver CS5 program.
Local Site Folder: Click on the folder icon button and navigate to the folder on your local computer where your site files are located. if you have not yet created a folder where your local site files will be stored, please create one and then select it as local site folder.
et
You will need to enter information for the following fields:
Server Name: You can choose any name. It will serve to define the connection for this particular site in your Dreamweaver CS5 program.
Connect using: Choose the FTP option.
FTP address: This is your_domain.com, where your_domain.com is your actual domain name. You can also use the hostname of the server on which your account is hosted. This information can be found in the Welcome e-mail message of your hosting account.
Port: This setting should be pre-selected, but have in mind that the correct port setting is 21.
In the "Username" and "Password" fields you need to specify the FTP login details you want to connect with. Normally, you would want to connect with your main Control Panel username/password pair. In case you want to connect with an FTP subuser you previously created at your FTP Manager Control Panel section, you need to specify the login details for that particular user.
Root Directory: You can leave this field empty, or you can enter /www/www. If you need to publish to a subdomain on your site, please enter /www/subdomain_name, where subdomain_name must be replaced with the name of your subdomain. For example, if you have sub.your_domain.com, you should type in /www/sub in the Root Directory field.
Web URL: Enter http://www.your_domain.com , where your_domain.com must be replaced with your own domain name.
Use Passive FTP: Make sure this option is checked.
Use FTP performance optimization: This option is pre-selected, but you can deselect it in case your Dreamweaver CS5 program cannot connect to the server.
Once you have filled out all of the needed fields, you can test the connection by pressing the Test button.
From the Server Model drop-down menu select the PHP MySQL option, then click on the Save button. When you return to the previous screen, make sure to check the Testing checkbox. 5. You can also set up some other options for your site using the other sections in the left pane of the Site Setup screen. However, they are not related to the way you publish your site to the hosting server. Once you are ready, please click the Save button, and your new site will be saved in the Dreamweaver CS5 program.
From the drop-down menu, which at the above screenshot shows Remote server, you can also select Local view. The Local view option will show the files you have in your local site folder.
To upload a single file to the server, select the file from Local view and click on the Put Files button (the arrow pointing upwards). This will upload the selected file to the server.
Another option is to use the Synchronize button (the one with the two rotating arrows in the next screenshot).
I use this all the time it is what you need, just one file but in your settings use this:
if($_SERVER['HTTP_HOST'] == 'localhost') //if url for test server is http://localhost/your_file.php
{
//Dev
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "password";
$db['default']['database'] = "database";
}
else
{
//Live
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "converse";
$db['default']['password'] = "password";
$db['default']['database'] = "public_prod";
}
Just change the if statement to match what your host is on testing server and that is it.
I have used this forever works great just a simple wrapper on your connect information. pay no attention to inside the if and else it is just codeigniter's database variables but the core if statement is what does it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.