|
楼主 |
发表于 2012-3-31 16:20:02
|
显示全部楼层
这是个city 的控制器, 并在view里找到对应的city_all.php city_tour.php但为什么得到空白页呢?
PHP复制代码
class City extends Controller {
private $section = "city";
private $submenu = array("place" => "Turistik Mekanlar",
"tour" => "Gezi Program?",
"transport" => "Ula??m",
"stay" => "Konaklama",
"photo" => "Foto?raflar",
"video" => "Videolar"
);
function City ()
{
parent ::Controller();
$this->load->model('city_model');
$this->load->model('comment_model');
}
function index ()
{
redirect ("city/all");
}
function all ()
{
$photos = $this->city_model->get_random_photos();
$view_data = array(
"section" => $this->section,
"submenu" => $this->submenu,
"cid" => 0,
"ssm" => '',
"breadcrumb" => "<a href='".base_url ()."city/all'>?in Turizmi</a>",
"subtitle" => "images/sub_title_ct.png",
"submenutitle" => "images/sub_menu_title_ct.png",
"media_list" => $photos
);
$this->template->write_view("content", "city_all", $view_data);
$this->template->render();
}
function place ($cid, $scid = null)
{
$city = $this->city_model->get_city($cid);
if ($scid > 0)
{
$content = $this->city_model->get_sub_content($cid, $scid, "place");
$subcontents = array();
$back_link = $this->section . "/place/" . $cid;
}
else
{
$content = $this->city_model->get_content($cid, "place");
$subcontents = $this->city_model->get_sub_contents($cid, "place");
$back_link = "";
}
$photos = $this->city_model->get_photos($cid);
$comments_id = md5($this->session->userdata('current_page'));
$comments = $this->comment_model->get_comments($comments_id);
$this->comment_model->add_comment_section(array("cid" => $comments_id, "section" => $this->session->userdata('current_page')));
$view_data = array(
"section" => $this->section,
"submenu" => $this->submenu,
"cid" => $cid,
"ssm" => 'place',
"breadcrumb" => "<a href='".base_url ()."city/all'>?in Turizmi</a> > " . $city->name . " > <a href='".base_url ()."city/place/".$cid."'>Turistik Mekanlar</a>" . ($scid > 0 ? " > <a href='".base_url ()."city/place/".$cid."/".$scid."'>".$content->title."</a>" : ""),
"subtitle" => "images/sub_title_ct.png",
"submenutitle" => "images/sub_menu_title_ct.png",
"city" => $city,
"content" => $content,
"subcontents" => $subcontents,
"media_list" => $photos,
"comments_id" => $comments_id,
"comments" => $comments,
"back_link" => $back_link
);
$this->template->write_view("content", "city_place", $view_data);
$this->template->render();
}
function tour ($cid, $scid = null)
{
$city = $this->city_model->get_city($cid);
if ($scid > 0)
{
$content = $this->city_model->get_sub_content($cid, $scid, "tour");
$subcontents = array();
$back_link = $this->section . "/tour/" . $cid;
}
else
{
$content = $this->city_model->get_content($cid, "tour");
$subcontents = $this->city_model->get_sub_contents($cid, "tour");
$back_link = "";
}
$photos = $this->city_model->get_photos($cid);
$comments_id = md5($this->session->userdata('current_page'));
$comments = $this->comment_model->get_comments($comments_id);
$this->comment_model->add_comment_section(array("cid" => $comments_id, "section" => $this->session->userdata('current_page')));
$view_data = array(
"section" => $this->section,
"submenu" => $this->submenu,
"cid" => $cid,
"ssm" => 'tour',
"breadcrumb" => "<a href='".base_url ()."city/all'>?in Turizmi</a> > " . $city->name . " > <a href='".base_url ()."city/tour/".$cid."'>Gezi Program?</a>" . ($scid > 0 ? " > <a href='".base_url ()."city/tour/".$cid."/".$scid."'>".$content->title."</a>" : ""),
"subtitle" => "images/sub_title_ct.png",
"submenutitle" => "images/sub_menu_title_ct.png",
"city" => $city,
"content" => $content,
"subcontents" => $subcontents,
"media_list" => $photos,
"comments_id" => $comments_id,
"comments" => $comments,
"back_link" => $back_link
);
$this->template->write_view("content", "city_tour", $view_data);
$this->template->render();
}
function transport ($cid, $scid = null)
{
$city = $this->city_model->get_city($cid);
if ($scid > 0)
{
$content = $this->city_model->get_sub_content($cid, $scid, "transport");
$subcontents = array();
$back_link = $this->section . "/transport/" . $cid;
}
else
{
$content = $this->city_model->get_content($cid, "transport");
$subcontents = $this->city_model->get_sub_contents($cid, "transport");
$back_link = "";
}
$photos = $this->city_model->get_photos($cid);
$comments_id = md5($this->session->userdata('current_page'));
$comments = $this->comment_model->get_comments($comments_id);
$this->comment_model->add_comment_section(array("cid" => $comments_id, "section" => $this->session->userdata('current_page')));
$view_data = array(
"section" => $this->section,
"submenu" => $this->submenu,
"cid" => $cid,
"ssm" => 'transport',
"breadcrumb" => "<a href='".base_url ()."city/all'>?in Turizmi</a> > " . $city->name . " > <a href='".base_url ()."city/transport/".$cid."'>Ula??m</a>" . ($scid > 0 ? " > <a href='".base_url ()."city/transport/".$cid."/".$scid."'>".$content->title."</a>" : ""),
"subtitle" => "images/sub_title_ct.png",
"submenutitle" => "images/sub_menu_title_ct.png",
"city" => $city,
"content" => $content,
"subcontents" => $subcontents,
"media_list" => $photos,
"comments_id" => $comments_id,
"comments" => $comments,
"back_link" => $back_link
);
$this->template->write_view("content", "city_transport", $view_data);
$this->template->render();
}
function stay ($cid, $scid = null)
{
$city = $this->city_model->get_city($cid);
if ($scid > 0)
{
$content = $this->city_model->get_sub_content($cid, $scid, "stay");
$subcontents = array();
$back_link = $this->section . "/stay/" . $cid;
}
else
{
$content = $this->city_model->get_content($cid, "stay");
$subcontents = $this->city_model->get_sub_contents($cid, "stay");
$back_link = "";
}
$photos = $this->city_model->get_photos($cid);
$comments_id = md5($this->session->userdata('current_page'));
$comments = $this->comment_model->get_comments($comments_id);
$this->comment_model->add_comment_section(array("cid" => $comments_id, "section" => $this->session->userdata('current_page')));
$view_data = array(
"section" => $this->section,
"submenu" => $this->submenu,
"cid" => $cid,
"ssm" => 'stay',
"breadcrumb" => "<a href='".base_url ()."city/all'>?in Turizmi</a> > " . $city->name . " > <a href='".base_url ()."city/stay/".$cid."'>Konaklama</a>" . ($scid > 0 ? " > <a href='".base_url ()."city/stay/".$cid."/".$scid."'>".$content->title."</a>" : ""),
"subtitle" => "images/sub_title_ct.png",
"submenutitle" => "images/sub_menu_title_ct.png",
"city" => $city,
"content" => $content,
"subcontents" => $subcontents,
"media_list" => $photos,
"comments_id" => $comments_id,
"comments" => $comments,
"back_link" => $back_link
);
$this->template->write_view("content", "city_stay", $view_data);
$this->template->render();
}
function photo ($cid, $pid = 0)
{
if (!($pid > 0))
{
$first_pid = $this->city_model->get_first_photo_id($cid);
if ($first_pid > 0)
{
redirect ("city/photo/" . $cid . "/" . $first_pid . "#1");
}
}
$city = $this->city_model->get_city($cid);
$photo = $this->city_model->get_photo($cid, $pid);
$photos = $this->city_model->get_photos($cid);
$comments_id = md5($this->session->userdata('current_page'));
$comments = $this->comment_model->get_comments($comments_id);
$this->comment_model->add_comment_section(array("cid" => $comments_id, "section" => $this->session->userdata('current_page')));
$view_data = array(
"section" => $this->section,
"submenu" => $this->submenu,
"cid" => $cid,
"ssm" => 'photo',
"breadcrumb" => "<a href='".base_url ()."city/all'>?in Turizmi</a> > " . $city->name . " > <a href='".base_url ()."city/photo/".$cid."'>Foto?raflar</a>",
"subtitle" => "images/sub_title_ct.png",
"submenutitle" => "images/sub_menu_title_ct.png",
"city" => $city,
"content" => $photo,
"media_list" => $photos,
"comments_id" => $comments_id,
"comments" => $comments
);
$this->template->write_view("content", "city_photo", $view_data);
$this->template->render();
}
function video ($cid, $vid = 0)
{
if (!($vid > 0))
{
$random_vid = $this->city_model->get_random_video_id($cid);
if ($random_vid > 0)
{
redirect ("city/video/" . $cid . "/" . $random_vid);
}
}
$city = $this->city_model->get_city($cid);
$video = $this->city_model->get_video($cid, $vid);
$photos = $this->city_model->get_photos($cid);
$comments_id = md5($this->session->userdata('current_page'));
$comments = $this->comment_model->get_comments($comments_id);
$this->comment_model->add_comment_section(array("cid" => $comments_id, "section" => $this->session->userdata('current_page')));
$view_data = array(
"section" => $this->section,
"submenu" => $this->submenu,
"cid" => $cid,
"ssm" => 'video',
"breadcrumb" => "<a href='".base_url ()."city/all'>?in Turizmi</a> > " . $city->name . " > <a href='".base_url ()."city/video/".$cid."'>Videolar</a>",
"subtitle" => "images/sub_title_ct.png",
"submenutitle" => "images/sub_menu_title_ct.png",
"city" => $city,
"content" => $video,
"media_list" => $photos,
"comments_id" => $comments_id,
"comments" => $comments
);
$this->template->write_view("content", "city_video", $view_data);
$this->template->render();
}
} 复制代码 |
|