Sunday, March 15, 2009

To do list application

I have moved my writing to my own site at http://komunitasweb.com



Please see my newest tutorial on CodeIgniter, building simple to do list application

Monday, August 27, 2007

My issue with mod_rewrite

With my xammp in Windows, enable mod_rewrite is so easy. I just need to uncomment module mod_rewrite in Apache configuration (httpd.conf), restart apache, then everything just fine.
Of course i still need to add .htaccess.

In my Ubuntu linux machine, i need to struggle just to enable mod_rewrite module. I figure out that in linux machine (Ubuntu), apache configuration was in different file , but i figure it out and activate the mod_rewrite. In phpinfo(), i can see mod_rewrite is active, but then nothing change. I can't use clean url from mod_rewrite. I thought i made a mistake in .htaccess file because i just copy the setting from codeigniter user guide.

Then after a few hours reading documentation, i figure out that in my apache linux (Ubuntu) AllowOverride was set to none, meanwhile in my XAMMP it was set to All, i change that, restart apache, and everything just fine. Now, Apache recognize my .htaccess.

If i'm right, in my apache linux machine, the configuration was set so that .htaccess file can't override apache configuration.

Am i right???

Tuesday, August 21, 2007

CodeIgniter Tutorial #2

my friends ask me, how he could add a css file to the view.
such an easy question for you guys but not for me and my friend
the codeigniter file structure didnt mention where to put your css, image, or javascript file.
hei, dont get me wrong... i just a newbie

then i remember, i've codeigniter application (BambooInvoice by Derek Allard)
this is how BambooInvoice file structure like

+ codeigniter_system
+ img
+ css
+ js

let demonstrate
Here my css file that i store in css/style.css

css/style.css

* {
margin:0;
padding:0;
}

#message {
margin:10px;
padding:10px;
border:1px solid #e1e1e1;
}

.info {
margin-top:15px;
color:#fff;
background: #237295;
padding:4px;
}


and here my controller

codeigniter/system/application/controller/blog.php (controller)

<?php

class Blog extends Controller {

function index() {
$data['title'] = "Yet another blog tutorial";
$data['blogs'] = array();
$this->load->helper('url');
$this->load->view('blog/index', $data);
}
}
?>


and here is my view

codeigniter/system/application/view/blog/index.php (view)


<html>
<head>
<title><?= $title ?></title>
<link rel='stylesheet' type='text/css' media='all'
href='<?php echo base_url()."css/style.css"?>' />
</head>
<body>
<div id="message">
<h1>Welcome to CSS layout!</h1>
This style from style.css
<div class="info">Page rendered in {elapsed_time}
seconds</div>
</div>
</body>
</html>


Note that before you can use base_url function, you have to add url helper by add $this->load->helper('url') to your controller

Friday, August 17, 2007

CodeIgniter Tutorial #1 Installation

I think CodeIgniter installation is straightforward, just follow the instructions from the CodeIgniter user guide
The instructions say

CodeIgniter is installed in four steps:

  1. Unzip the package.
  2. Upload the CodeIgniter folders and files to your server. Normally the index.php file will be at your root.
  3. Open the application/config/config.php file with a text editor and set your base URL.
  4. If you intend to use a database, open the application/config/database.php file with a text editor and set your database settings.

but then again i just wanna share my installation. CodeIgniter, here we come...

Windows CodeIgniter installation

Requirement :
For the servers i use XAMPP (say my thanks for those guy behind XAMPP for bundling what i need),
ok then after my XAMPP installation (just a few click ok..ok..ok and you will get there) and get codeigniter then
  • Unzip the package in your root webroot (in XAMPP .../Program Files/xampp/htdocs/)
  • Rename CodeIgniterXXXX to codeigniter (optional).
  • Start your server (in XAMPP Start->All Programs->apachefriends->xampp->CONTROL XAMPP SERVER PANEL or click XAMPP Control Panel icon in your desktop and start apache and mysql)
  • Open you browser and type http://localhost/codeigniter/

you will see this


and you'r done. Check the user guide for informations, the user guide is awesome.


Linux CodeIgniter installation ( Ubuntu Linux, Feisty Fawn )


Note that in standard Ubuntu installation you wont get apache server, mysql server, and php.
so install those things...

hehehe, well nothing to explain in this section. just follow the steps from the user guide.

i put my CodeIgniter package in my webroot, unzip, and everything goes well except for the mod_rewrite setting. I'll show
you later about my mod_rewrite setting (because of i don't know how to that)

if i made a mistake, tell me about it, i will learn from my mistake, and maybe another person can learn from my mistakes

Tuesday, August 14, 2007

Great Tutorials about CodeIgniter

Well, i google about CodeIgniter tutorials this morning and found some great tutorials, and here my list.
  1. CodeIgniter Tutorial, screencast from codeigniter website
  2. Introduction to Code Igniter, GodBit wrote a very great tutorials in his website
  3. CodeIgniter Pagination, GodBit wrote another great tutrorials
  4. Building an RSS Feed in CodeIgniter


Well that's it for now... i'll add the list by the time goes by.

My first post on CodeIgniter

This was taken from codeigniter website :
CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you're a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you're tired of ponderously large and thoroughly undocumented frameworks
Codeigniter is one of those frameworks that is influenced by Ruby on Rails. It's offer MVC (Model-View-Controller), great manual, community. It is developed by pMachine, who also create Expression Engine CMS. Actually most of the code was taken from the Expression Engine (CMIIW).

I'm still new on this framework, but anyway as i learn something new about it, i'll keep that new knowledge of mine to be posted here.

CodeIgniter Official Site :
http://www.codeigniter.com/