|
|
|
รบกวนช่วยแก้ php หน้าถัดไป หน้าก่อนหน้านี้อะไรแบบนี้อ่ะครับ |
|
|
|
|
|
|
|
คือมันเป็น โมดูล ของ cms เขาทำแจกเอาไว้แล้วมันเก่าไปนิดมันเลยต้องแก้หรือมันผิดพลาดตรงไหนผมก็ไม่รู้ครับช่วยดูให้ที
มันจะแสดงแบบนี้ครับ |< < 1 2 แต่กดอันไหนมันก็จะขึ้นหน้าที่เปิดอยู่สมมุติผมเปิดหน้า 1อยู่ คลิกจะไปหน้า 2 มันก็มาหน้า 1 เหมือนเดิม พอผมไปหน้า 2 โดยการเติมทาง url address แล้วคลิกเพื่อจะให้กลับหน้า 1 มันก็เปิดหน้า 2 มาเหมือนเดิม
ไฟล์ที่เกี่ยวข้องน่าจะมี 2 ไฟล์นี้ครับ
1.
Code
<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content">
<div class="top">
<div class="left"></div>
<div class="right"></div>
<div class="center">
<h1><?php if($nameboard == "") {echo $text_title;}else{echo $nameboard;} ?></h1>
</div>
</div>
<div class="middle">
<div class="content">
<?php if($webboard_guest == "1" || $register_user != null || $admin !=null) { ?>
<div style="margin-top: 12px; text-align: right;"><a onclick="location='<?php echo 'index.php?route=webboard/new_post'; ?>'" class="button"><span><?php echo $text_newpost; ?></span></a></div>
<? } else { ?>
<div style="margin-top: 12px; text-align: right;"><a onclick="location='<?php echo 'index.php?route=webboard/board'; ?>'" class="button"><span><?php echo $text_newpost_alert; ?></span></a></div>
<? } ?>
<table border="0" width="100%" id="table1">
<tr>
<td bgcolor="#CCFFFF" align="center"><?=$text_order?></td>
<td bgcolor="#CCFFFF" align="center"><?=$text_title_board?></td>
<td bgcolor="#CCFFFF" align="center"><?=$text_read?></td>
<td bgcolor="#CCFFFF" align="center"><?=$text_reply?></td>
<td bgcolor="#CCFFFF" align="center"><?=$text_author?></td>
</tr>
<?
$i=0;
foreach ($ask as $ask_post) {
if ($i%2==1) {$chk=' bgcolor="#CCFFCC" ';}else{$chk='';}
if (iconv_strlen($ask_post['title'],"utf-8") > 40) {$ask=iconv_substr($ask_post['title'],0,20,"utf-8")."...";}else{$ask=$ask_post['title'];}
?>
<tr>
<td align="center" <?=$chk?>>
<? if ($admin !=null) { ?>
<a href="index.php?route=webboard/board&act=delete&id=<?=$ask_post['ask_id'];?>&page=<?=$page?>" onClick="return Conf(this)" >
<img src="catalog/view/theme/default/image/b_drop.png" alt="delete" border="0" />
</a>
<? } ?>
<?=$ask_post['ask_id'];?>
<? if ($admin !=null) { ?>
<a href="index.php?route=webboard/edit&id=<?=$ask_post['ask_id'];?>&page=<?=$page?>">
<img src="catalog/view/theme/default/image/b_edit.png" alt="edit" border="0" />
</a>
<? } ?>
</td>
<td <?=$chk?>>
<a href="index.php?route=webboard/read_board&id=<?=$ask_post['ask_id']?>" title="<?=$ask_post['title']?>"><?=$ask;?></a>
<? if ($ask_post['new'] <= $webboard_day) {?>
<img src="catalog/view/theme/default/image/new.gif" alt="new" />
<? } ?>
</td>
<td align="right" <?=$chk?>><?=number_format($ask_post['counter']);?></td>
<td align="right" <?=$chk?>>
<? if ($ask_post['new_reply'] <= $webboard_day) {?>
<img src="catalog/view/theme/default/image/new.gif" alt="new" />
<? } ?>
<?=number_format($ask_post['number_reply']);?>
</td>
<td align="right" <?=$chk?>><?=$ask_post['author'];?></td>
</tr>
<?
$i++;
}
?>
</table>
<div class="pagination"><?php echo $pagination; ?></div>
</div>
</div>
<div class="bottom">
<div class="left"></div>
<div class="right"></div>
<div class="center"></div>
</div>
</div>
<?php echo $footer; ?>
<script Language="Javascript">
<!--
function Conf(Object) {
if (confirm("<?=$alert?>") == true){
return true;
}
return false;
}
//-->
</script>
2
Code
<?php
class ControllerWebboardBoard extends Controller {
private $act;
private $data_ask=array();
private $ask_new=array();
public function index() {
$this->language->load('webboard/board');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('webboard/webboard');
$this->document->breadcrumbs = array();
$this->document->breadcrumbs[] = array(
'href' => (HTTP_SERVER . 'index.php?route=common/home'),
'text' => $this->language->get('text_home'),
'separator' => FALSE
);
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_title'] = $this->language->get('text_title');
$this->data['text_order'] = $this->language->get('text_order');
$this->data['text_title_board'] = $this->language->get('text_title_board');
$this->data['text_read'] = $this->language->get('text_read');
$this->data['text_reply'] = $this->language->get('text_reply');
$this->data['text_date'] = $this->language->get('text_date');
$this->data['text_author'] = $this->language->get('text_author');
$this->data['text_delete'] = $this->language->get('text_delete');
$this->data['text_mark'] = $this->language->get('text_mark');
$this->data['text_newpost'] = $this->language->get('text_newpost');
$this->data['text_newpost_alert'] = $this->language->get('text_newpost_alert');
$this->data['alert'] = $this->language->get('alert');
$this->data['nameboard'] = html_entity_decode($this->config->get('webboard_name'));
$this->data['webboard_guest'] = html_entity_decode($this->config->get('webboard_guest'));
$this->data['webboard_day'] = html_entity_decode($this->config->get('webboard_day'));
$this->data['register_user']=html_entity_decode($this->customer->isLogged());
if (isset($this->user['user_id'])) {$this->data['admin']=$this->user['user_id'];}else{$this->data['admin']=null;}
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/webboard/board.tpl')) {
$this->template = $this->config->get('config_template') . '/template/webboard/board.tpl';
} else {
$this->template = 'default/template/webboard/board.tpl';
}
$this->children = array(
'common/header',
'common/footer',
'common/column_left',
'common/column_right'
);
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
if (isset($this->request->get['id'])) {
$id = $this->request->get['id'];
}
if (isset($this->request->get['act'])) {
$this->act = $this->request->get['act'];
}
$this->data['page'] = $page;
if ($this->act=="delete") {
$this->model_webboard_webboard->DeleteTopic($id) ;
$redirect=$this->redirect((HTTPS_SERVER . 'index.php?route=webboard/board&page='.$page));
}
$pagination = new Pagination();
$pagination->total = $this->model_webboard_webboard->getAllBoard();
$pagination->page = $page;
$pagination->limit = html_entity_decode($this->config->get('webboard_num_show')); //กำหนดจำนวนแสดงต่อหน้า
$pagination->text = $this->language->get('text_pagination');
$pagination->url = (HTTP_SERVER . 'index.php?route=webboard/board&page='.$page);
$this->data['pagination'] = $pagination->render();
$this->data['continue'] = (HTTP_SERVER . 'index.php?route=common/home');
$this->data_ask=$this->model_webboard_webboard->getAskPost($page,$pagination->limit);
foreach ($this->data_ask as $ask){
$this->ask_new[]=array(
'number_reply' => $this->model_webboard_webboard->getQuessBoardNumber($ask['ask_id']),
'author' => $ask['author'],
'ask_id' => $ask['ask_id'],
'title' => $ask['title'],
'detail' => $ask['detail'],
'date' => $ask['date'],
'counter' => $ask['counter'],
'new' => floor((strtotime("now") - strtotime($ask['date']))/(3600*24) ),
'new_reply'=> $this->model_webboard_webboard->CheckDateOfQuess($ask['ask_id'])
);
}
$this->data['ask'] = $this->ask_new;
$this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
}
}
?>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2012-03-31 15:51:57 |
By :
peam |
View :
966 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เอา Code แบบนี้มาดู มันยากน่ะครับ
|
|
|
|
|
Date :
2012-03-31 19:09:49 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อ่าครับ เดี๋ยวผมลองมั่วเองดูก่อน แล้วกัน ขอบคุณมากครับ
|
|
|
|
|
Date :
2012-03-31 19:37:49 |
By :
peam |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แก้ได้แล้ว ขอบคุณมากคร้าบบ
|
|
|
|
|
Date :
2012-03-31 23:33:30 |
By :
peam |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|