where("id", $id)->find(); if (empty($item->id)) { return Kohana::show_404(); } if (request::method() == 'get') { if ($item->type == 'album') { url::redirect("album/$id"); } else { url::redirect("photo/$id"); } } else { $key = $this->input->post("key"); $value = $this->input->post("value"); $item->$key = $value; $item->save(); print $value; } } }