<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>labs &#187; development</title>
	<atom:link href="http://earthpeople.se/labs/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://earthpeople.se/labs</link>
	<description>earth people labs</description>
	<lastBuildDate>Tue, 15 May 2012 07:58:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha</generator>
		<item>
		<title>CodeIgniter development site &#8211; on live environment</title>
		<link>http://earthpeople.se/labs/2010/10/codeigniter-development-site-on-live-environment/</link>
		<comments>http://earthpeople.se/labs/2010/10/codeigniter-development-site-on-live-environment/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 12:25:39 +0000</pubDate>
		<dc:creator>peder fjällström</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[ci]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://earthpeople.se/labs/?p=205</guid>
		<description><![CDATA[We recently had to set up a development site for an existing CodeIgniter site, and we wanted to do this effortless. Ideal would obviously be to have a separate virtual domain or a separate box but hey, &#8220;ideal&#8221; isn&#8217;t always ideal, heh. By applying the same principle as in our previous WordPress article on the [...]]]></description>
			<content:encoded><![CDATA[<p>We recently had to set up a development site for an existing CodeIgniter site, and we wanted to do this effortless. Ideal would obviously be to have a separate virtual domain or a separate box but hey, &#8220;ideal&#8221; isn&#8217;t always ideal, heh.</p>
<p>By applying the same principle as in <a href="http://earthpeople.se/labs/2010/05/setting-up-a-wp-dev-environment-on-a-live-site/">our previous WordPress article on the same topic</a>, this is done in well under 5 minutes. Upload the same /dev folder as in the WordPress case, and make the following modification in the main CodeIgniter index.php file.</p>
<p>Change this:</p>
<pre>$system_folder = "system";</pre>
<p>to:</p>
<pre>if(isset($_COOKIE["dev"])){
	$system_folder = "sysdev";
}else{
	$system_folder = "system";
}</pre>
<p>Then copy the /system directory to /sysdev &#8211; and that will be your new development docroot. Once you&#8217;re ready to release your next version, either copy each file from /sysdev to /system &#8211; or simply change the name of /system to /system-OLD and /sysdev to /system.</p>
<fb:like 
		href="http://earthpeople.se/labs/2010/10/codeigniter-development-site-on-live-environment/" 
		layout="standard" 
		show_faces="false" 
		width="450" 
		
		action="like" 
		colorscheme="light" 
		style="margin-top:5px;"
		class="fb_edge_widget_with_comment fb_iframe_widget"></fb:like>]]></content:encoded>
			<wfw:commentRss>http://earthpeople.se/labs/2010/10/codeigniter-development-site-on-live-environment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>setting up a wp dev environment on a live site</title>
		<link>http://earthpeople.se/labs/2010/05/setting-up-a-wp-dev-environment-on-a-live-site/</link>
		<comments>http://earthpeople.se/labs/2010/05/setting-up-a-wp-dev-environment-on-a-live-site/#comments</comments>
		<pubDate>Fri, 07 May 2010 14:42:04 +0000</pubDate>
		<dc:creator>peder fjällström</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://earthpeople.se/labs/?p=134</guid>
		<description><![CDATA[developing a wordpress site on the domain it eventually will live on has plenty of advantages (and ok, a few obvious disadvantages not covered in this post&#8230;). no need to fiddle around in the db looking for hardcoded urls to the development domain name and when it&#8217;s time to launch &#8211; you don&#8217;t need to [...]]]></description>
			<content:encoded><![CDATA[<p>developing a wordpress site on the domain it eventually will live on has plenty of advantages (and ok, a few obvious disadvantages not covered in this post&#8230;). no need to fiddle around in the db looking for hardcoded urls to the development domain name and when it&#8217;s time to launch &#8211; you don&#8217;t need to bother with db export/imports and stuff.</p>
<p>but &#8211; how to do this when there&#8217;s already an existing site live on this domain? actually it&#8217;s accomplished pretty easily.</p>
<p>make a folder on your live site, call it something like &#8220;dev&#8221;, put this into the index.php file within this folder:</p>
<pre>if(isset($_GET["mode"])&amp;&amp;$_GET["mode"]=="dev"){
	setcookie("dev","true", time()+3600*24*7, "/");
	header("Location: /dev");
}else if(isset($_GET["mode"])&amp;&amp;$_GET["mode"]=="live"){
	setcookie("dev", "", time()-1000, "/");
	header("Location: /dev");
}
if(isset($_COOKIE["dev"])){
	echo "DEVELOPMENT MODE IN YOUR BROWSER: ON | <a href="?mode=live">SWITCH</a>";
}else{
	echo "DEVELOPMENT MODE IN YOUR BROWSER: OFF | <a href="?mode=dev">SWITCH</a>";
}
</pre>
<p>when a user enters /dev on your live site and clicks ON, a cookie will be set. this cookie can then be checked for, and the server can make a decision wether to show the old site or the development site.</p>
<p>next upload wordpress the usual way to the docroot of the site, and install. make sure you don&#8217;t overwrite any existing files on the server when uploading.</p>
<p>lastly &#8211; let&#8217;s make that cookie work for us. open the file wp-blog-header.php, located in the docroot, and replace the contents with this:</p>
<pre>if(isset($_COOKIE["dev"])){ # does the user have the dev cookie?
	if ( !isset($wp_did_header) ) {
		$wp_did_header = true;
		require_once( dirname(__FILE__) . '/wp-load.php' );
		wp();
		require_once( ABSPATH . WPINC . '/template-loader.php' );
	}
}else{
	header("Location: currentindex.htm"); # no? then show the current page
}
</pre>
<p>one word of warning though &#8211; do not run wordpress auto update while developing the site this way. doing so will remove the cookie-check in wp-blog-header.php and exposing your development site to the world. should you need to run the automatic update, remember to make the changes to wp-blog-header.php again.</p>
<p>when you&#8217;re ready to go live with your shiny new wordpress site &#8211; just remove the cookie check from wp-blog-header.php and let the world in. that&#8217;s it folks!</p>
<fb:like 
		href="http://earthpeople.se/labs/2010/05/setting-up-a-wp-dev-environment-on-a-live-site/" 
		layout="standard" 
		show_faces="false" 
		width="450" 
		
		action="like" 
		colorscheme="light" 
		style="margin-top:5px;"
		class="fb_edge_widget_with_comment fb_iframe_widget"></fb:like>]]></content:encoded>
			<wfw:commentRss>http://earthpeople.se/labs/2010/05/setting-up-a-wp-dev-environment-on-a-live-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

