$c = new EMongoCriteria();
$c->addCondition('is_visible',(int)1);
$c->sort = array('publicated_at'=>-1); // ASC:1, DESC:-1
$pages = new CPagination(Feedback::model()->count($c));
$pages->pageSize = 6;
$pages->applyLimit($c);
$models = Feedback::model()->find($c);
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
json_encode($info,JSON_UNESCAPED_UNICODE); //available since php 5.4.0 |
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
function string_to_ascii($string) | |
{ | |
$ascii = array(); | |
for ($i = 0; $i < strlen($string); $i++) | |
{ | |
$ascii[] =$string[$i].':'.ord($string[$i]); | |
} | |
return(implode(' ', $ascii)); |
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
▾ - arrow down |
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
function plural_str(i, str1, str2, str3){ | |
function plural (a){ | |
if ( a % 10 == 1 && a % 100 != 11 ) return 0 | |
else if ( a % 10 >= 2 && a % 10 <= 4 && ( a % 100 < 10 || a % 100 >= 20)) return 1 | |
else return 2; | |
} | |
switch (plural(i)) { | |
case 0: return str1; | |
case 1: return str2; |
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
<!-- OLD SCHOOL METHOD FROM 2000 --> | |
<style> | |
div.center-2 { position: relative; float: left; left: 50%; margin: 0; padding: 0; z-index:2} | |
div.center-2 div.center-3 { position: relative; float: left; right: 50%;z-index:2 } | |
div.center-1 {overflow: hidden;} | |
</style> | |
<div class="center-1"><div class="center-2"><div class="center-3"> | |
... | |
</div></div></div> |
Some of the answers here are for inifite page. What Salman is asking is lazy loading of images.
Plugin: http://www.appelsiini.net/projects/lazyload
Demo: http://www.appelsiini.net/projects/lazyload/enabled.html
EDIT: How do these plugins work?
This is a simplified explanation:
- http://leaverou.github.io/regexplained/ - объяснение регулярок в онлайне
- http://jviereck.github.io/regexp.js/ - объяснение регулярок в онлайне
- http://www.phpliveregex.com/ - PHP regexe
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
sleep 25m; notify-send -u critical "O_O"; mocp --pause; |