|
 |
|
syntax error, unexpected T_SL เกี่ยวกับอะไรเหรอค่ะท่านผู้รู้ตอบหน่อยสิ เดือนร้อนจริง |
|
 |
|
|
 |
 |
|
search หาใน google เจอไหมค่ะ 
|
 |
 |
 |
 |
Date :
2009-11-30 12:09:46 |
By :
looknam |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอดูโค้ดหน่อยครับ น่าจะเป็นการเขียน HEREDOC ผิด
|
 |
 |
 |
 |
Date :
2009-11-30 12:27:01 |
By :
xbeginner01 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?php
/**
* @author Marosdee
* @copyright 2009
*/
class pagination
{
var $perPage = 10;
var $defaultPage = 1;
var $totalCount = 0;
var $pagination = '';
var $defaultLink = '';
var $maxPage = 1;
public function __construct( $page, $perPage='', $totalCount='', $link='' )
{
if ( is_numeric($page) && $page > 0 ) $this->defaultPage = $page;
if ( is_numeric($perPage) && $perPage > 0 ) $this->perPage = $perPage;
if ( is_numeric($totalCount) && $totalCount > 0 ) $this->totalCount = $totalCount;
if ( $this->totalCount >= $this->perPage ) $this->maxPage = ceil( $this->totalCount / $this->perPage );
$this->defaultLink = $this->checkLink($link);
}
public function getPagination()
{
if ( $this->defaultPage == 1 )
{
$this->pagination .= ' <span>First</span> ';
}
else
{
$this->pagination .= ' <a href="' . $this->defaultLink . 'page=1" >First</a> ';
$this->pagination .= ' <a href="' . $this->defaultLink . 'page=' . ( $this->defaultPage - 1 ) . '" >Back</a> ';
}
if ( $this->maxPage <= 9 )
{
for ( $i = 1; $i <= $this->maxPage; $i++ )
{
$this->pagination .= $this->_getPagination($i);
}
}
else
{
for ( $i = 1; $i <= $this->maxPage; $i++ )
{
if ( $i == 1 || $i <= 3 )
{
$this->pagination .= $this->_getPagination($i);
}
elseif ( ( $this->maxPage - $i ) == 0 || ( $this->maxPage - $i ) <= 2 )
{
$this->pagination .= $this->_getPagination($i);
}
elseif ( $this->defaultPage >= 6 || ( $this->maxPage - $this->defaultPage ) >= 6 )
{
if ( ( $this->defaultPage - $i ) < 2 && ( $this->defaultPage - $i ) > -2 )
$this->pagination .= $this->_getPagination($i);
elseif ( ( $this->defaultPage - $i ) < 5 && ( $this->defaultPage - $i ) > -5 )
$this->pagination .= '.';
}
}
}
if ( $this->defaultPage == $this->maxPage )
{
$this->pagination .= ' <span>Last</span> ';
}
else
{
$this->pagination .= ' <a href="' . $this->defaultLink . 'page=' . ( $this->defaultPage + 1 ) . '" >Next</a> ';
$this->pagination .= ' <a href="' . $this->defaultLink . 'page=' . $this->maxPage . '" >Last</a> ';
}
return <<<HTMLBLOCK
<table width="100%">
<tr>
<td align="center" width="99%">
<div class="pagination">{$this->pagination}</div>
</td>
</tr>
</table>
HTMLBLOCK;
}
private function _getPagination($i)
{
if ( $this->defaultPage == $i )
{
return ' <span class="pagination_current">' . $i . '</span> ';
}
else
{
return ' <a href="' . $this->defaultLink . 'page=' . $i . '" class="pagination">' . $i . '</a> ';
}
}
private function checkLink($link)
{
if ( strpos($link, '?') )
return $link . '&';
else
return $link . '?';
}
}
//$pag = new pagination($_GET['page'],10,50,'');
//echo $pag->getPagination();
?>
|
 |
 |
 |
 |
Date :
2009-11-30 14:01:10 |
By :
kabton_hok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันจะ error บรรทัดที่ Parse error: syntax error, unexpected T_SL in C:\AppServ\www\search\class.pagination.php on line 117
|
 |
 |
 |
 |
Date :
2009-11-30 14:06:56 |
By :
kabton_hok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
return <<<HTMLBLOCK
บรรทัดนี้ครับ เช็คข้างหลังมี spacebar รึเปล่า มีก็ลบออก
|
 |
 |
 |
 |
Date :
2009-11-30 14:47:07 |
By :
xbeginner01 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|