Skip to main content

Membuat website dengan CodeIgniter Part1

Langsung aja saya jabarkan kebutuhan yg akan di pakai nanti untuk membuat sebuah website dari framework codeigniter...
pertama..
ya tentu saja source dari codeigniter-nya... bisa pake yg terbaru atau 2.0 ++ disini

kedua..
database -nya bisa menggunakan MySql yg udah di bundle ke dalam Xampp disini

ketiga (optional)
Editor teks.... pake notepad oke... pake netbeans oke juga...

Langkah selanjutnya adalah install terlebih dahulu xampp-nya jika sudah ada xamppnya, lanjut ke langkah selanjutnya, lalu kemudian extract source Codeigniter di htdocs xampp.
berikut susunan direktori Codeigniter
root dir....
        .../application
                  .../cache
                  .../config
                  .../controllers
                  .../core
                  .../errors
                  .../helpers
                  .../hooks
                 .../language
                 .../libraries
                 .../logs
                 .../models
                 .../third_party
                 .../views                   
        .../system
        .../user_guide
        .../index.php
        .../license.txt


langkah berikutnya adalah buka direktori atau folder config dan edit file config.php
config.php
$config['base_url']    = 'http://localhost/contoh-web';  // edit pada bagian ini sesuai nama folder atau direktori root anda di htdocs.

lalu buka file autoload.php yang masih berada di dalam direktori config...
isikan parameter yang kita butuhkan untuk dapat membuat sebuah aplikasi...

$autoload['libraries'] = array('database', 'encrypt', 'form_validation');
$autoload['helper'] = array('url', 'text', 'date', 'form', 'email');

 untuk sementara settingan yang kita buat baru sampai disini dalam source code codeigniter... untuk itu kita fokuskan terlebih dahulu dengan rancangan database untuk aplikasi yang akan kita buat ini.
pertama tentukan terlebih dahulu tabel yang akan di jadikan sebagai kunci utama aplikasi atau web yang akan kita buat kali ini...

misal :
CREATE TABLE IF NOT EXISTS `contents` (
  `id` int(32) NOT NULL AUTO_INCREMENT,
  `titles` varchar(200) NOT NULL,
  `date` datetime NOT NULL,
  `text` text NOT NULL,
  `img` varchar(100) DEFAULT NULL,
  `type` tinyint(1) NOT NULL DEFAULT '1',
  `categories_id` int(32) NOT NULL,
  `users_id` int(32) NOT NULL,
  `status` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ; 









analisis tabel :
pada tabel diatas sengaja di pilih nama table content karena dapat memudahkan kita memasukkan berbagai tipe atau jenis, misal posting, berita, news dll dengan pengaturan tipe content terdapat di dalam field type. Pada tabel content terdapat join terhadap 4 tabel, yaitu categories, users, comment, images. dengan hubungan dari content ke categories adalah many to one, content ke users many to one, content ke comment many to many, sedangkan content dengan images adalah one to many.

CREATE TABLE IF NOT EXISTS `categories` (
  `id` int(32) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `desc` tinytext NOT NULL,
  `status` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;


CREATE TABLE IF NOT EXISTS `users` (
  `id` int(32) NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `fullname` varchar(200) NOT NULL,
  `password` varchar(32) NOT NULL,
  `email` varchar(100) NOT NULL,
  `joindate` datetime NOT NULL,
  `level` tinyint(1) NOT NULL,
  `notes` tinytext NOT NULL,
  `status` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;


CREATE TABLE IF NOT EXISTS `images` (
  `id` int(32) NOT NULL AUTO_INCREMENT,
  `date` datetime NOT NULL,
  `title` varchar(100) NOT NULL,
  `url` varchar(100) NOT NULL,
  `contents_id` int(32) NOT NULL,
  `desc` tinytext NOT NULL,
  `status` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;


CREATE TABLE IF NOT EXISTS `comments` (
  `id` int(32) NOT NULL AUTO_INCREMENT,
  `date` datetime NOT NULL,
  `title` varchar(100) NOT NULL,
  `text` text NOT NULL,
  `image` varchar(100) NOT NULL,
  `users_id` int(32) NOT NULL,
  `status` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


to be continued.

Comments

Popular posts from this blog

A history of Einstein

Around 1886 Albert Einstein began his school career in Munich. As well as his violin lessons, which he had from age six to age thirteen, he also had religious education at home where he was taught Judaism. Two years later he entered the Luitpold Gymnasium and after this his religious education was given at school. He studied mathematics, in particular the calculus, beginning around 1891.  In 1894 Einstein's family moved to Milan but Einstein remained in Munich. In 1895 Einstein failed an examination that would have allowed him to study for a diploma as an electrical engineer at the Eidgenössische Technische Hochschule in Zurich. Einstein renounced German citizenship in 1896 and was to be stateless for a number of years. He did not even apply for Swiss citizenship until 1899, citizenship being granted in 1901.  Following the failing of the entrance exam to the ETH, Einstein attended secondary school at Aarau planning to use this route to enter the ETH in Zurich. While at Aarau he wr...

A history of Michael Jackson

Okay Here i want post with history of King of the POP in world. For remember story of Jackson and his carier in world. Hard to believe - this was Michael Jackson. He was born August 28, 1958 - one of 9 kids. His father reportedly nicknamed him "Big Nose".  Mike was born a cute African-American guy. "Normal", if you will, and very talented. Despite the current, sad stories about his lonely, sad childhood, Mike grew up surrounded by famous people and an adoring public. At age 5, Mike and his brothers were the amazing 'Jackson 5'. They played locally, then in New York and Philly. They were "discovered" by Gladys Knight and pianist Billy Taylor at the famous Apollo Theater in Harlem. By age 11, Mike was a Superstar. At age 13 he went solo and had his first #1 hit at 14 with "Ben" (a touching love song to a rat). Who knew he'd get addicted to plastic surgery, face accusations of child molestation and end up America's Most Famous Sidesh...