<?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>CloverBlog</title>
	<atom:link href="http://www.cloverstudio.es/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cloverstudio.es/blog</link>
	<description>Otro Blog de WordPress</description>
	<lastBuildDate>Thu, 05 May 2011 20:38:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Configuración avanzada de CodeIgniter 1: Utilizando una instalación común a todas las aplicaciones</title>
		<link>http://www.cloverstudio.es/blog/2009/11/13/configuracion-avanzada-de-codeigniter-1-utilizando-una-instalacion-comun-a-todas-las-aplicaciones/</link>
		<comments>http://www.cloverstudio.es/blog/2009/11/13/configuracion-avanzada-de-codeigniter-1-utilizando-una-instalacion-comun-a-todas-las-aplicaciones/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 19:05:47 +0000</pubDate>
		<dc:creator>Gonzalo</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.cloverstudio.es/blog/?p=19</guid>
		<description><![CDATA[En este post, se explican las ventajas de utilizar una instalación de CodeIgniter compartida entre todas las aplicaciones, y una manera sencilla de hacerlo.]]></description>
			<content:encoded><![CDATA[<p>Cuando comienzas un proyecto utilizando el framework CodeIgniter como base, quizá hagas una copia de todos los ficheros de la última versión de CodeIgniter. Este método es el más sencillo inicialmente, pero tiene el inconveniente de aumentar el tamaño del proyecto innecesariamente, y es en el futuro dificil actualizar la versión de CodeIgniter, sobre todo si desarrollamos unas cuantas webs.<span id="more-19"></span></p>
<h3>Paso 1: Almacenar las versiones de CodeIgniter en una carpeta común</h3>
<p>La idea es tener una carpeta de nuestro servidor weben la que iremos almacenando las distintas versiones de CodeIgniter, a medida que vayan publicandose. Por ejemplo:</p>
<pre>/var/www/lib/codeigniter/CodeIgniter_1.7.2
/var/www/lib/codeigniter/CodeIgniter_1.7.3</pre>
<h3>Paso 2: Crear las carpetas de nuestro proyecto</h3>
<p>Vamos a crear un proyecto CodeIgniter de ejemplo, en la carpeta</p>
<pre>/var/www/ejemplo</pre>
<p>y dentro de esta carpeta:</p>
<ul>
<li> copiaremos la carpeta <strong>application</strong>, que está dentro de system en CodeIgniter.</li>
<li>crearemos una carpeta <strong>public</strong>, que será la raiz para el servidor web.</li>
<li>copiaremos dentro de public el fichero <strong>index.php</strong>, que viene con CodeIgniter</li>
<li>si utilizamos <strong>.htaccess</strong> para <a href="http://www.codeigniter.com/user_guide/general/urls.html" target="_blank">quitar index.php de las URLs</a>, lo pondremos dentro de public.</li>
</ul>
<p>Al final tendremos algo como esto:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>ejemplo<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000; font-weight: bold;">|</span>-- application
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- config
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- autoload.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- config.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- constants.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- database.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- doctypes.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- hooks.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- index.html
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- mimes.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- routes.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- smileys.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">`</span>-- user_agents.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- controllers
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- index.html
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">`</span>-- welcome.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- errors
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- error_404.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- error_db.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- error_general.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- error_php.php
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">`</span>-- index.html
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- helpers
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">`</span>-- index.html
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- hooks
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">`</span>-- index.html
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- index.html
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- language
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">`</span>-- english
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>       <span style="color: #000000; font-weight: bold;">`</span>-- index.html
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- libraries
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">`</span>-- index.html
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>-- models
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">`</span>-- index.html
<span style="color: #000000; font-weight: bold;">|</span>   <span style="color: #000000; font-weight: bold;">`</span>-- views
<span style="color: #000000; font-weight: bold;">|</span>       <span style="color: #000000; font-weight: bold;">|</span>-- index.html
<span style="color: #000000; font-weight: bold;">|</span>       <span style="color: #000000; font-weight: bold;">`</span>-- welcome_message.php
<span style="color: #000000; font-weight: bold;">`</span>-- public
 <span style="color: #000000; font-weight: bold;">|</span>-- index.php
 <span style="color: #000000; font-weight: bold;">|</span>-- .htaccess
 <span style="color: #000000; font-weight: bold;">|</span>-- css
 <span style="color: #000000; font-weight: bold;">|</span>-- img
 <span style="color: #000000; font-weight: bold;">`</span>-- js</pre></div></div>

<p>Debemos indicar a CodeIgniter donde se encuentran las carpetas que contienen el sistema y los ficheros de nuestra aplicación.</p>
<p>Editamos el fichero index.php que hemos colocado en public, y editamos las 2 lineas en donde se indican las rutas:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">|---------------------------------------------------------------</span>
<span style="color: #339933;">|</span> <span style="color: #990000;">SYSTEM</span> FOLDER NAME
<span style="color: #339933;">|---------------------------------------------------------------</span>
<span style="color: #339933;">|</span>
<span style="color: #339933;">|</span> This variable must contain the name of your <span style="color: #0000ff;">&quot;system&quot;</span> folder<span style="color: #339933;">.</span>
<span style="color: #339933;">|</span> <span style="color: #b1b100;">Include</span> the path <span style="color: #b1b100;">if</span> the folder is not in the same  directory
<span style="color: #339933;">|</span> <span style="color: #b1b100;">as</span> this <span style="color: #990000;">file</span><span style="color: #339933;">.</span>
<span style="color: #339933;">|</span>
<span style="color: #339933;">|</span> NO TRAILING SLASH<span style="color: #339933;">!</span>
<span style="color: #339933;">|</span>
<span style="color: #339933;">*/</span>
        <span style="color: #000088;">$system_folder</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/var/www/CodeIgniter_1.7.2/system&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
|---------------------------------------------------------------
| APPLICATION FOLDER NAME
|---------------------------------------------------------------
|
| If you want this front controller to use a different &quot;application&quot;
| folder then the default one you can set its name here. The folder
| can also be renamed or relocated anywhere on your server.
| For more info please see the user guide:
| http://codeigniter.com/user_guide/general/managing_apps.html
|
|
| NO TRAILING SLASH!
|
*/</span>
        <span style="color: #000088;">$application_folder</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;../application&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
|===============================================================
| END OF USER CONFIGURABLE SETTINGS
|===============================================================</span></pre></div></div>

<p>Ahora configuramos nuestro servidor web para que la carpeta raiz sea public, y accedemos al sitio web con el navegador. Debería salirnos la página saludo de CodeIgniter.</p>
<p>A partir de aquí, podemos utilizar CodeIgniter de la manera habitual, almacenando nuestros controladores, librerias, modelos, etc. en la carpeta application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cloverstudio.es/blog/2009/11/13/configuracion-avanzada-de-codeigniter-1-utilizando-una-instalacion-comun-a-todas-las-aplicaciones/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

