Compile CodeIgniter User Guide on Windows

For users following the development of CodeIgniter, the documentation for the upcoming 3.0 release will be in a different format. Previously the CodeIgniter documentation was created and published in html format. The dev at CodeIgniter have switched to using Markdown and Sphinx for creating the source files to be compiled into html format. This allows for easier syntax highlighting as this is taken care of by Markdown and Sphinx.

Some of the components needed to compile the user guide, are not installed by default on Windows. Here are the steps to getting Ruby, Sphinx, and CI-Lexer installed on Windows XP and Vista/7.

I am using WAMP on my Windows computer for development, so I have CodeIgniter installed in the diretory:

c:\wamp\www\codeigniter\

This folder will be referenced a few times in the lines of code below. If you have CodeIgniter running in a different directory, you will need to change references to those directories.
The first step is to install Python. I found Python version 2.7 was best, because it was the easiest to setup one of the necessary dependencies.

1. Download Python 2.7.3 Installer for Windows.

Install this to the default folder which will be c:\Python27. After the installation completes we need to setup easy_install for Python.

2. For 32bit users you can download setuptools-0.6c11.win32-py2.7.exe and run the installer. For 64bit users you need to download ez_setup.py. Save the file to c:\Python27 (default installation directory). click the Start button in the lower left corner and click Run. In the dialog box type:

cmd

Then press the OK buttons. This will open the Windows command prompt. Then type:

cd c:\Python27\

For 64bit users only type:

python ez_setup.py

Now we have easy_install setup and ready to use so we can install Sphinx. To install Sphinx simple type:

cd Scripts
easy_install sphinx

Now we have Sphinx setup we need to install the PHP syntax highligher for Sphinx. Type the following command:

easy_install sphinxcontrib-phpdomain

The next step is to install the CI Lexer to get syntax highlighting support for CodeIgniter. We need to switch to our CodeIgniter folder that has the user guide sr Type the following command:

cd c:\wamp\www\codeigniter\user_guide_src\cilexer
c:\Python27\python.exe setup.py install

Now everything is setup to compile the CodeIgniter user guide from the Markdown source. The first run will take some time, so be patient. If you were wanting to contribute, and update the user guide, the compilation process on runs on pages that are updated after the first run. This usually only takes a few seconds. The Markdown source is located in the user_guide_src/source folder inside of your CodeIgniter setup. To run the compiler use the following command:

c:\Python27\Scripts\sphinx-build -b html c:\wamp\www\codeigniter\user_guide_src\source c:\wamp\www\codeigniter\user_guide_html

The -b html commandline option tells Sphinx to compile in html format. Now if you look inside your CodeIgniter folder you will see a new folder /user_guide_html. This will be the complete html user guide.

If all is you want is the latest user guide for CI 3.0, you can access it as well at http://codeigniter.com/nightly_user_guide/