• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Development test/sandbox site

#1
[eluser]BigErnMcCracken[/eluser]
I'm trying to figure out the easiest way to create a test 'sandbox' site so I can test functionality, display, etc on my site. I read through the 'Managing Applications' section of the user guide, but it requires that I use a different index.php (i.e. I would have a sandbox.php and a production.php for example) file.

The problem with this is that in the sandbox my URL's would be
Code:
<a href="sandbox.php/controller/method">
and in order to move everything over the production site I would need to change all of those to
Code:
<a href="production.php/controller/method">
which I would rather not do. It would be to have it set up so that when I am finished testing, I can just move the file to my production code base and be done. I also realize that I can use the php 'SELF' variable in place of the "production.php" but because other people developing on this site might not understand that, I would like to avoid using it.

So is there a way of creating a test server using the same index.php file?

#2
[eluser]xwero[/eluser]
Just a question before i give you my view on things. How are you going to keep your controllers apart?

If you use 2 index.php files and point them to separate application directories. In the config file you set the right index.php and for all your links and so on you can use url helper/config library for
Code:
// controller
$url = $this->config->site_url();
// view
<a href="&lt;?php echo site_url(); ?&gt;controller/method">
And you don't have to change anything in the view or controller files if you want to relocate them.

#3
[eluser]BigErnMcCracken[/eluser]
Right, thats what I had mentioned earlier, I could use the 'SELF' variable or the site_url() function to generate the links, but I was attempting to do this without using PHP. If I don't have a choice then I guess thats the only solution.

#4
[eluser]John_Betong[/eluser]
[quote author="BigErnMcCracken" date="1192655051"]I'm trying to figure out the easiest way to create a test 'sandbox' site so I can test functionality, display, etc on my site.
...
...
...

[/quote]

Hi BigErnMcCracken,

The way I handle it is to have my Browser's Homepage point to a localhost menu simialr to this: Menu

This link explains it in depth: http://ellislab.com/forums/viewthread/59270/

In a nutshell: (belt & braces technique to retain your existing working setup Smile

1. Copy the CodeIgniter application folder to the same level as your CodeIgniter system folder and rename it to "ci_application".
2. Copy the folder again and to the same level and rename it "ci_sandbox"
3. In your index.php file: Set $application_folder = "ci_application";
4. Set your ci_application/config/config.php variables if necessary
5. Set your ci_application/config/routes.php variables if necessary
6. Run index.php and get your ci_application working.

Once working then reset index.php file: Set $application_folder = "ci_sandbox"; and repeat steps 4, 5 & 6 with "ci_sandbox" replacing "ci_application"

Once all three applications (including your original application) are working then:
1. Create your _menu.php form and have radio buttons set the $_SESSION['application'] variable.
2. On submit, redirect your header("Location: index.php");
3. Modify your index.php file: Set $application_folder = $_SESSION['application'];

I think it is well worth the effort and especially when messing with sub-domains!

Advantage:
1. Easily update or change the single CodeIgniter version
2. Online updates: rename your online application folder and copy the local updated folder.
3. Easily revert back or change to a previous version.
4. Can have the Menu point to the old existing site to be CodeIgnited.

I am also curious to know how other people handle the same problem.

Cheers,

John_Betong
&nbsp;
// Edit: sepelling and included Advantages
&nbsp;

#5
[eluser]BigErnMcCracken[/eluser]
That sounds like a great solution. Now you only have one index.php for two sites. That was in reality my goal but I wasn't really sure how to go about doing it. Thanks much John_Betong.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.