Oct 282012

Assalamu’ alaikum wr wb

Yii upload images

Kali ini saya akan berbagi bagaimana cara upload gambar dengan menggunakan framework Yii (Yes It Is). Yii mempunyai banyak sekali extension yang dapat kita gunakan untuk mempermudah program yang akan kita buat. Untuk kali ini kita akan membuat upload image dengan menggunakan extension Upload yang sudah tersedia di Yii.

Yang di butuhkan :

  1. Apache.
  2. Yii Framework.
  3. Upload Extension.
Setelah download extension extrack semuake dalam folder extensions. Untuk penggunakan anda bisa membaca dalam link yang diats di upload extension. contoh :
// import the class

// receive file from post
$Upload = new Upload( (isset($_FILES['Filedata']) ? $_FILES['Filedata'] : null) );
$Upload->jpeg_quality  = 100;
$Upload->no_script     = false;
$Upload->image_resize  = true;
$Upload->image_x       = 700;
$Upload->image_y       = 500;
$Upload->image_ratio   = true;

// some vars
$newName  = date('YmdHis');
$destPath = Yii::app()->getBasePath().'/../images/gallery/';
$destName = '';

// verify if was uploaded
if ($Upload->uploaded) {
  $Upload->file_new_name_body = $newName;

  // if was processed
  if ($Upload->processed) {
    $destName = $Upload->file_dst_name;

    // write image filename on table
    $photo = new Photo();
    $photo->gallery = $_POST['gallery_id'];
    $photo->image_normal = $destName;
    $photo->image_thumb  = 'thumb_' . $destName;

    // create the thumb

    $Upload = new Upload($destPath.$destName);
    $Upload->file_new_name_body   = 'thumb_' . $newName;
    $Upload->no_script            = false;
    $Upload->image_resize         = true;
    $Upload->image_x              = 120;
    $Upload->image_y              = 80;
    $Upload->image_ratio          = true;

  } else {
} else {
  echo('Select a file to send');
Ok selamat mencoba gitu saja ya untuk pengembangan silakan di buat sendiri ya.
Sumber : http://www.yiiframework.com

Wassalamu’ alaikum wr wb

Oct 122012

Assalamu’ alaikum wr wb

Ternyata http://u.kaskus.co.id/ pake CI (CodeIgniter)


Saya tadi tidak sengaja menemukan halaman error pada http://u.kaskus.co.id/  yang ternyata masih pake default error pada CodeIgniter . brikut penampakannya.


Wassalamu’ alaikum wr wb

Jul 162012

Composite Primary Key di yii

Assalamu’ alaikum wr wb

Pengertian dari Composite Primary Key adalah adalah kunci yang terdiri dari 2 atau lebih atribut yang secara unik mengidentifikasi suatu kejadian entitas. Setiap atribut yang membentuk kunci senyawa adalah kunci sederhana dalam haknya sendiri.

Untuk membuat crud dalam Yii secara default yii mengharuskan ada satu primary key, kalo ada 2 atau lebih key maka gii yang ada pada yii akan menolak.

Trus bagaimana caranya, Berikut adalah langkah – langkahnya.

edit controller, di sini saya punya table dengan nama tbl_dokter_obat dengan primary key ada pada [d_code, o_code].

    public function actionView($id, $id2) {
        $this->render('view', array(
            'model' => $this->loadModel($id, $id2),
    public function actionUpdate($id,$id2) {
        $model = $this->loadModel(  $id,$id2 );

        // Uncomment the following line if AJAX validation is needed
        // $this->performAjaxValidation($model);

        if (isset($_POST['DokterObat'])) {
            $model->attributes = $_POST['DokterObat'];
            if ($model->save())
                $this->redirect(array('view', 'id' => $model->d_code ,'id2'=>$model->o_code));

        $this->render('update', array(
            'model' => $model,
    public function actionDelete($id,$id2) {
        if (Yii::app()->request->isPostRequest) {
            // we only allow deletion via POST request

            // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
            if (!isset($_GET['ajax']))
                $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
            throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
    public function loadModel($id,$id2) {
        $model = DokterObat::model()->findByPk(array('d_code'=>$id,'o_code'=>$id2));
        if ($model === null)
            throw new CHttpException(404, 'The requested page does not exist.');
        return $model;

Kode diatas di gunakan untuk CRUD
Setelah itu ubah juga pada tombol link yang ada pada view admin.

<?php $this->widget('zii.widgets.grid.CGridView', array(
				'view' => array
					'url'=>'Yii::app()->createUrl("dokterobat/view", array("id"=>$data->d_code,"id2"=>$data->o_code))',
				'update' => array
					'url'=>'Yii::app()->createUrl("dokterobat/update", array("id"=>$data->d_code,"id2"=>$data->o_code))',
				'delete' => array
					'url'=>'Yii::app()->createUrl("dokterobat/delete", array("id"=>$data->d_code,"id2"=>$data->o_code))',
)); ?>

Kode di atas di gunakan untuk mengubah parameter pada tombol yang ada pada grid.
Oke selamat mencoba.

Wassalamu’ alaikum wr wb

Jan 312011

CodeIgniter 2.0.0 Released

Today EllisLab and the CodeIgniter Reactor Engineers are proud to announce the first official release of CodeIgniter 2.0.0, which is being released in two flavors:

CodeIgniter Core

Core is a slow-moving branch that will be used as the base for EllisLab commercial products such as ExpressionEngine and MojoMotor. It will continue at a similar pace that CodeIgniter has in the past and will be useful for large commercial applications that require the upmost in stability and backward/forward compatibility at a pace more typical of SLA backed Enterprise products.  Core is publicly available with tagged downloads at BitBucket.

CodeIgniter Reactor

Reactor is a community driven branch of CodeIgniter that will enable faster adoption of the best community submitted code to the framework. This means the community can create a fork of the project on BitBucket and contribute bug fixes, new features, documentation improvements, etc and have it reviewed by a code-review team called Reactor Engineers. These Engineers are primarily responsible for driving the development of the framework.

Changes and features made by EllisLab to Core will be merged into Reactor, and EllisLab will actively contribute to Reactor’s development.  Reactor is the recommended version of CodeIgniter for use in the majority of day to day work. When you see “CodeIgniter” by itself on this web site, it is referring to CodeIgniter Reactor.  The downloads, documentation, and forums all reflect this change.  Put simply, Reactor = CodeIgniter.

Some of the big changes to happen in CodeIgniter 2.0 since CodeIgniter 1.7.3 are:

  • Support for PHP 4 is gone, PHP 5.1 is now a requirement.
  • CSRF Protection built into the form helper
  • Drivers
  • Application Packages
  • Scaffolding, having been deprecated for a number of versions, has been removed.
  • Removed the deprecated Validation Class.
  • Plugins have been removed, in favor of Helpers.
  • Added routing overrides to the main index.php file, enabling the normal routing to be overridden on a per “index” file basis.
  • Added $route[‘404_override’] to allow 404 pages to be handled by controllers.
  • 50+ bugs fixed

Reactor contains all of these above and some nice changes of its own:

  • Full query-string support
  • Automatic base_url detecion if left blank
  • New Cache driver with file system, APC and memcache support
  • Command line compatibility for easy cron jobs
  • 20+ tweaks and improvements

Have a look at the change log for the full list of improvements and enhancements.

The Engineer team is also working on, or close to completing these features for a future Q1 release:

User Guide Note Contribution

Users will soon be able to contribute notes to each page in the user guide in the fashion that php.net currently allows. This will make CodeIgniter’s already-extensive documentation even more useful as time goes on. The new comment system is versioned, which will allow obsolete comments to be pruned from newer version without affecting older ones.

Authentication Driver

A common request for a long time (and with almost 800 votes on UserVoice) is an Authentication library. This is something we would like to do if the right solution and approach can be found, but it will take time and a lot of work to make a solution generic enough for everyone without being overly complex.

A More Object-like Model

A backward-compatible tweak currently in testing is a feature that allows active-record results to be returned as instances of the models they represent. This will allow for a more semantic approach to dealing with database rows.

CodeIgniter is now a much more community-oriented framework than it has been in the past. You can submit pull requests via BitBucket or Phil’s GitHub mirror. You’ll also see new releases far more frequently.

What are you waiting for?  Download it now and start cloning!

– The Reactor Team

Sumber : http://codeigniter.com/news/codeigniter_2.0.0_released/

Dec 172009
No Images


Lama tidak membuka http://www.extjs.com/ tadi barusan buka eh ternyata ada berita baru ExtJs 3.1 telah release apa saja ya kira – kira tambahan pada versi ini.

Wah akan asik lagi nih untuk explorasi lagi kira – kira ada tambahan apa pada versi ini. untuk dapat mendownloadnya silakan masuk ke sini http://www.extjs.com/products/extjs/download.php .

Sudah siap untuk explorasi lagi …….ok mari kita explor lagi.