|
|
|
ทำ pagpagination แล้ว error maximum execution time of 30 seconds exceeded... |
|
|
|
|
|
|
|
จะทำ pagpagination แล้ว error maximum execution time of 30 seconds exceeded...
ลองเข้าไป set max_executime_time = 300 ใน php.ini ก็ยัง error อยู่ดี
controller
Code (PHP)
public function index($page = '1')
{
//initializing search condition
$conditions = array(1);
$publication_id = null;
if($publication_id = trim($this->input->get('publication_id')))
{
$conditions = array('id = ?', $publication_id);
}
$offset = ($page - 1) * $this->config->item('admin_items_per_page');
$publications = Publication::all(array('conditions' => $conditions, 'order' => 'year desc', 'limit' => $this->config->item('admin_items_per_page'), 'offset' => $offset));
$publications_count = Publication::count(array('conditions' => $conditions));
$totalPublication = Publication::count();
$publications_count_msg = number_format($publications_count);
$page_msg = number_format($page);
if($publication_id)
$this->data['search_result'] = "พบ $publications_count_msg เอกสารเผยแพร่ จาก Keyword \"".Publication::get_title_by_id($publication_id)."\" <small> — หน้าที่ $page_msg</small>";
else
$this->data['search_result'] = "พบ $publications_count_msg เอกสารเผยแพร่ <small> — หน้าที่ $page_msg</small>";
//set data to view
$this->data['page'] = $page;
$this->data['pagination'] = $this->_create_pagination($publications_count, "publications/index");
$this->data['publications'] = $publications;
$this->data['totalPublication'] = $totalPublication;
$this->data['title'] = "เอกสารเผยแพร่";
$this->data['page_styles'] = array('selectize.bootstrap3.css');
$this->data['page_scripts'] = array('selectize.min.js');
$this->data['inpage_script'] = 'publications/_index_js';
$this->data['view_name'] = "publications/index";
$this->data['view_name_sidebar'] = "publications/sidebar";
$this->load->view('layouts/_main/index', $this->data);
}
view
Code (PHP)
<div class="container">
<div id="content">
<div class="info">
<div class="clear"></div>
<h1><i class="fa fa-file-o"></i> <span>สื่อวิชาการ</span></h1>
<p class="researchStat">จำนวนงานวิจัยในฐานข้อมูลทั้งหมด: <?php echo $totalPublication; ?> งานวิจัย</p>
<?php if($q = $this->input->get('q')): ?>
<p class="researchStat"><i>แสดงผลการค้นหา '<?php echo $q; ?>' จำนวน <?php echo $numbersOfsearchResults; ?> งานวิจัย</i></p>
<?php endif; ?>
<h2>รายชื่องานวิจัย</h2>
<div id="publicationLists">
<?php foreach ($publications as $publication): ?>
<div class="publicationBlock">
<div class="publicationInfo">
<!-- <span class="title">→ <a href="<?php echo base_url("publications/view/".$publication->id."?q=$q&page=$pageNum"); ?>"></a></span> -->
<i class="fa fa-tag"></i> <b>หัวข้อ : </b><?php echo $publication->title;?><br>
<i class="fa fa-user"></i> <b>ผู้แต่ง : </b>
<?php if ($publication->publications_authors): ?>
<?php echo $publication->publications_authors->name;?>
<?php else: ?>
<?php echo "ไม่ได้ระบุผู้แต่ง";?>
<?php endif; ?><br>
<i class="fa fa-file"></i> <b>ประเภทของสื่อ : </b>
<?php if ($publication->publication_category): ?>
<?php echo $publication->publication_category->name; ?>
<?php endif; ?>
</div>
<div class="clear"></div>
</div>
<?php endforeach; ?>
<hr>
</div>
<div class="clear"></div>
<div class="paginator">
<?php if($pageNum == 1): ?>
<span class="start-page">← prev</span>
<?php else: ?>
<a class="previous" href="?page=<?php echo $pageNum-1; ?>&q=<?php echo $q; ?>">← prev</a>
<?php endif; ?>
<?php
// calculate page number to be rendered as a link
$listPage = 3; $listStart = -1; $listEnd = -1;
( $pageNum < 3*$listPage ) ? $listStart = 1 : $listStart = $pageNum - $listPage;
if ($maxPages - $pageNum < 2*$listPage ) {
$listEnd = $maxPages;
if ( $maxPages - $pageNum < 2*$listPage && $pageNum > 3*$listPage )
$listStart = $pageNum - ( 2*$listPage - ($maxPages - $pageNum));
}
else {
if ($pageNum < 2*$listPage ) { $listEnd = 3*$listPage;}
else $listEnd = $pageNum + $listPage;
}
?>
<?php for($i = $listStart; $i < $listEnd; $i++): ?>
<?php if ($i == $pageNum): ?>
<span class="selected-page"><?php echo $i; ?></span>
<?php else: ?>
<a href="?page=<?php echo $i; ?>&q=<?php echo $q; ?>"><?php echo $i; ?></a>
<?php endif; ?>
<?php endfor; ?>
<?php if ($listEnd != $maxPages): ?>
<span class="more">...</span>
<?php endif; ?>
<?php if($pageNum == $maxPages): ?>
<span class="end-page">next →</span>
<?php else: ?>
<a class="next" href="?page=<?php echo $pageNum+1; ?>&q=<?php echo $q; ?>">next →</a>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script type="text/javascript">
<!--
/*
$("span.summaryButton").click(function() {
$(this).toggleClass("collapsed");
$(this).next().toggleClass("hideText");
});
$("span.bibliographyButton").click(function() {
$(this).toggleClass("collapsed");
$(this).next().toggleClass("hideText");
});
*/
$("div.advance-search-button").click(function() {
$(this).toggleClass("collapsed");
$(this).next().toggleClass("hideText");
});
$("#year-start-select option:last-child").attr("selected", "selected");
$(".advance-search-fields").chosen();
$("div.advance-search-list").toggleClass("hideText");
$("#publicationLists").highlight("<?php echo $q; ?>");
-->
</script>
Tag : PHP, MySQL, HTML/CSS, JavaScript, Ajax
|
ประวัติการแก้ไข 2016-02-17 16:25:45
|
|
|
|
|
Date :
2016-02-17 16:24:52 |
By :
Sub.P |
View :
726 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|