1
뉴스 섹션에 대한 OpenCart에 대한 완전히 새로운 페이지를 만들려고합니다. 그리고 나는 모든 올바른 파일을 만들었습니다. 페이지 렌더링은 중간에 비어 있습니다. (헤더를 렌더링하고 바닥 글 괜찮아요). 내가 놓친 게 무엇입니까?!?새 페이지 OpenCart에 대한
링크 페이지를 칠 : index.php?route=common/news&news_id=A_NUMBER
테이블 덤프 :
CREATE TABLE IF NOT EXISTS `news` (
`id` int(255) NOT NULL AUTO_INCREMENT,
`user_id` int(255) NOT NULL,
`title` varchar(255) NOT NULL,
`body` longtext NOT NULL,
`added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`views` int(255) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
언어 (news.php) :
<?php
// Text
$_['heading_title'] = '%s';
?>
컨트롤러 (news.php) :
<?php
class ControllerCommonNews extends Controller {
private $error = array();
public function index() {
$this->language->load('common/news');
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home'),
'separator' => false
);
$news_id = $_REQUEST['news_id'];
$this->load->model('common/news');
$news_info = $this->model_common_news->getNews($news_id);
if ($news_info) {
$this->data['breadcrumbs'][] = array(
'title' => $news_info['title'],
'body' => $news_info['body']
);
}
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/news.tpl')) {
$this->template = $this->config->get('config_template') . '/template/common/news.tpl';
} else {
$this->template = 'default/template/common/news.tpl';
}
$this->children = array(
'common/column_left',
'common/column_right',
'common/content_top',
'common/content_bottom',
'common/footer',
'common/header'
);
$this->response->setOutput($this->render());
}
}
?>
남 ODEL (news.php) :
<?php
class ModelCommonNews extends Model {
public function getNews($news_id) {
$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "news WHERE id = '" . (int)$news_id . "'");
return $query->row;
}
}
?>
보기 (news.tpl) :
<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
<h1 style="display: none;"><?php echo $heading_title; ?></h1>
<?php echo $content_bottom; ?>
</div>
<?php echo $footer; ?>
이 더 많은 정보가 필요하면 멀리 물어! 어떤 도움이라도 대단히 감사합니다.
예, 저는 제품 컨트롤러를 살펴보기 시작했는데 그 줄을 추가하는 것을 잊어 버렸습니다. 이제는 왼쪽과 오른쪽 열이 해당 페이지의 모듈을로드하지 않는다는 것이 유일한 문제입니다. – rackemup420