Posts

Showing posts from June, 2013

Installing Propel in CodeIgniter

INSTALLING PROPEL IN CODEIGNITER Download CodeIgniter http://ellislab.com/codeigniter Download Propel ORM http://propelorm.org/download.html Inside CodeIgniter application directory, create the following directories: build build/data Note: Anywhere is fine, this is just for organization Unzip Propel ORM, copy the generator directory and rename to propel in application/build/data Copy build.properties-sample from build/data/propel to build/data without the ‘-sample’ Add the following data to build.properties with your own variables propel.project = ci propel.database = mysql propel.database.url = mysql:host=localhost;dbname=demo propel.database.user = root propel.database.password = password Then at the last part of the same file add: propel.project.dir = ${propel.home} propel.output.dir = ${propel.project.dir}/output propel.conf.dir = ${propel.project.dir} propel.sql.dir = ${propel.output.dir}/sql propel.graph.dir = ${propel.output.dir}/graphs propel.omtar.d

CodeIgniter - Extending Form Validation

Overview 1. Store all form validation in application/config/form_validation.php 2. Create a library to extend form validation for callback functions 3. Run the form validation inside the controller method Step 1: Create form_validation.php Create the file application/config/form_validation.php then add your form validations In my example, I’ll do something like the code below which validates the inputs when a user creates a news article $config = array( 'article' => array( array( 'field' => 'news_title', 'label' => 'Title', 'rules' => 'trim|required|max_length[100]' ), array( 'field' => 'news_body', 'label' => 'Body', 'rules' => 'trim|required' ), array( 'field' => 'news_category', 'label'

Setup Virtual Hosts in Ubuntu

Open terminal then run the command. cd /etc/apache2/sites-available/ sudo cp default llanalewis.dev sudo nano llanalewis.dev Change llanalewis.dev to your vhost name. In some ubuntu versions, default is 000-default Copy and paste the code below to llanalewis.dev : <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName llanalewis.dev DocumentRoot /home/user/public_html/llanalewis_dev <Directory /home/user/public_html/llanalewis_dev> AllowOverride All allow from all </Directory> </VirtualHost> Save and close the file then open /etc/hosts . Add the line below to the list of your hosts 127.0.0.1 llanalewis.dev Save and close /etc/hosts then on the terminal enable your new vhost by running the command below: sudo a2ensite llanalewis To disable the site, just run: sudo a2dissite llanalewis To apply the changes, restart your apache, type on the terminal: sudo service apache2 restart On your favorite browser, type your new virtual hos

Installing Symfony 2.0 Framework in Ubuntu

Symfony is PHP MVC framework used to create websites and web application. There are certain things you need to do first because you can run a Symfony website This guide provides a step by step instructions on setting up Symfony in your localhost. 1. Prepare the requirements. Follow the link of the ff softwares and packages to download: Symfony 2.0 with vendors ( preferrably v2.0.17 since this guide was based on that. ) Propel ORM Phing Propel Bundle 2. Extract each packages in its rightful location Symfony -> your web root Propel ORM -> Symfony/vendor Phing -> Symfony/vendor Propel Bundle -> Symfony/vendor/bundles/Propel 3. Register the Propel Bundle in app/AppKernel.php and app/autoload.php # add this code in app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Propel\PropelBundle\PropelBundle(), ); // ... } # add this code in app/autoload.php $loader->registerNamespaces(ar

Install Pear and Phing on Wamp Server

FOR WAMPSERVER Download http://pear.php.net/go-pear.phar Go to C:\wamp\bin\php\php5.x.x\ Save go-pear.phar to the php directory then run: php -d phar.require_hash=0 go-pear.phar On Pear installation, select local install, enter till the part about modifying php.ini (N) Run pear version to see if installation is successful Next, right-click wamp server tray icon, then click PHP → php.ini Uncomment include_path , set value to: include_path = ".;C:\wamp\php\php5.x.x\pear" Restart wamp server If it does not work, change directory to C:\wamp\bin\php\php5.x.x\ then change php.ini include_path = ".;C:\wamp\php\php5.x.x\pear" Restart wamp server Still inside php directory, run pear channel-discover pear.phing.info pear install phing/phing If installation requires root permission run: runas /user:Administrator cmd where Administrator is the account username of the administrator To run phing and pear from any directory, add the bat file to wind