Created
March 24, 2015 10:42
-
-
Save 5shekel/ba7f232eb74850359dbd to your computer and use it in GitHub Desktop.
This file contains 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 | |
$script="http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; | |
$sourceHTML = file_get_contents('wall.html'); | |
preg_match("/(.*?<body.*?>)(.*)(<\/body.*$)/is", $sourceHTML, $matches);//(.*)(<\/body.*$) | |
$top = $matches[1]; | |
$contents = $matches[2]; | |
$bottom = $matches[3]; | |
$top= str_replace("</head>", '<script src="js/jquery-1.6.4.min.js" type="text/javascript"></script>'."\n".'<script src="js/jquery.autopager-1.0.0.js" type="text/javascript"></script></head>', $top); | |
$inserts=""; | |
$splitContents = explode('<div class="feedentry hentry">', $contents); | |
$lastitemfix=explode('</div>', $splitContents[sizeof($splitContents)-1]); | |
$splitContents[sizeof($splitContents)-1]=$lastitemfix[0]."</div></div>"; | |
if(isset($_REQUEST["next"])) | |
$next=$_REQUEST["next"]; | |
else | |
$next=0; | |
if($next==0){ | |
$contentelement=$splitContents[0].'<div class="feedentry hentry content">'.$splitContents[1]; | |
$contentelement.='<div class="feedentry hentry content">'.$splitContents[2].'<div class="feedentry hentry content">'.$splitContents[3]; | |
$nextlink='<a href="'.$script.'?4" rel="next" style="display:none;">Next</a>'; | |
} | |
else | |
{ | |
$contentelement='<div class="feedentry hentry content">'.$splitContents[$next]; | |
if($next<sizeof($splitContents)) | |
$nextlink='<a href="'.$script.'?'.($next+1).'" rel="next" style="display:none;">Next</a>'; | |
else | |
$nextlink=''; | |
} | |
echo $top; | |
?> | |
<script type="text/javascript"> | |
$(function() { | |
$.autopager(); | |
}); | |
</script> | |
<?php | |
if($next==0) | |
echo $contentelement.$nextlink."</div>".$lastitemfix[sizeof($lastitemfix)-3]."</div></div>".$bottom; | |
else | |
echo $contentelement.$nextlink.$bottom; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment