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 Ir. Soekarno

Sukarno This is an Indonesian name; it does not have a family name  Ir. Sukarno 1st President of Indonesia In office 18 August 1945 – 12 March 1967 Prime Minister Sutan Sjahrir Amir Sjarifuddin Muhammad Hatta Abdul Halim Muhammad Natsir Soekiman Wirjosandjojo Wilopo Ali Sastroamidjojo Burhanuddin Harahap Djuanda Kartawidjaja Vice President Mohammad Hatta Succeeded by Suharto Born 6 June 1901 Blitar, Dutch East Indies Died 21 June 1970 (aged 69) Jakarta, Indonesia Political party None Spouse Oetari Inggit Garnasih Fatmawati Hartini Kartini Manoppo Ratna Sari Dewi Soekarno Haryati Yurike Sanger Heldy Djafar Religion Islam Signature  Sukarno, born Kusno Sosrodihardjo (6 June 1901 - 21 June 1970) was the first President of Indonesia. He helped the country win its independence from the Netherlands and was President from 1945 to 1967, presiding with mixed success over the country's turbulent transition to independence. Sukarno was forced out of power by one of his generals, Suharto, who ...