Created
January 22, 2011 17:48
-
-
Save emre/791297 to your computer and use it in GitHub Desktop.
emreyilmaz.me/yigit_ozgur/ adresinde calisan kod.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class ComicPaginater { | |
| public $pageLimit = 1100; | |
| public $page = 0; | |
| public $URL = 'http://www.emreyilmaz.me/yigit_ozgur'; | |
| public function __construct() { | |
| $this->page = intval(@$_GET["page"]); | |
| if($this->page == 0) { | |
| $this->page++; | |
| } | |
| } | |
| public function getNextLink() { | |
| if(($this->page + 1) <= $this->pageLimit) { | |
| return sprintf("<a href='?page=%s'>sonraki sayfa</a>", $this->page + 1); | |
| } | |
| return false; | |
| } | |
| public function getPreviousLink() { | |
| if(($this->page - 1) > 0) { | |
| return sprintf("<a href='?page=%s'>önceki sayfa</a>", $this->page - 1); | |
| } | |
| return false; | |
| } | |
| public function getPage() { | |
| return $this->page; | |
| } | |
| public function getComicHTML() { | |
| return sprintf("<img src='%s/img/yigit/%s.jpg' />", $this->URL, $this->getPage()); | |
| } | |
| public function getPageUrl() { | |
| return sprintf("%s/?page=%s", $this->URL, $this->getPage()); | |
| } | |
| } | |
| $paginate = new ComicPaginater(); | |
| ?> | |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
| <html xmlns="http://www.w3.org/1999/xhtml"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| <title>yiğit özgür</title> | |
| <link rel="stylesheet" type="text/css" href="style.css" /> | |
| <script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script> | |
| </head> | |
| <body> | |
| <div id="header"> | |
| <h2> | |
| <a href='?page=0'>yiğit özgür karikatürleri</a> | |
| </h2> | |
| </div> | |
| <div id="main"> | |
| <div style="padding-top:5px; padding-bottom:5px;"> | |
| <span> | |
| <a href="http://twitter.com/share" data-url="<?php echo $paginate->getPageUrl() ?>" class="twitter-share-button">Tweet</a> | |
| </span> | |
| </div> | |
| <?php echo $paginate->getComicHTML(); ?> | |
| <br /> | |
| <?php echo $paginate->getPreviousLink(); ?> - <?php echo $paginate->getNextLink();?> | |
| </div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment