public function __construct() { parent::__construct(); if (in_array($this->uri->rsegments(2, 0), array('edit', 'update', 'destroy', 'sort'))) { if (!(($id = $this->uri->rsegments(3, 0)) && ($this->promo = Promo::find_by_id($id)))) { return redirect_message(array('admin', $this->get_class()), array('_flash_message' => '找不到該筆資料。')); } } $this->add_tab('Promo列表', array('href' => base_url('admin', $this->get_class()), 'index' => 1))->add_tab('新增Promo', array('href' => base_url('admin', $this->get_class(), 'add'), 'index' => 2)); }