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
<ul class='pager'> | |
<?php | |
//The goal is to have a pager showing (if available) 5 numbers, | |
//with the current page number in the middle, if available. | |
// <<First and <Previous are shown if you can't see page 1, | |
// and Next> and Last>> are shown if you can't see the last page. | |
$start = $currentpage <= 2 ? 1 : $currentpage - 2; | |
$end = $currentpage > ($totalpages - 2) ? $totalpages : $currentpage + 2; | |
if ($end == $totalpages && $start > 2) { | |
$diff = $totalpages - $currentpage; |
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
<select name=”gender”> | |
<option value=”1”>Male</option> | |
<option value=”2”>Female</option> | |
</select> |
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 | |
if (!isset($_GET['src'])) { | |
//for testing, navigate to thumbnail.php?img=page/to/yourimage.jpg | |
echo "<img src='/thumbnail.php?src={$_GET['img']}' />"; | |
} else { | |
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); | |
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); | |
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 | |
header ("Pragma: no-cache"); // HTTP/1.0 | |
header("Content-type: image/pjpeg"); |
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 | |
if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "iphone") !== FALSE | |
|| strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "ipod") !== FALSE | |
|| strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "android") !== FALSE | |
|| strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "blackberry") !== FALSE ) { | |
include 'mobile.php'; | |
} else { | |
?><!DOCTYPE ... |
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
var jQT = new $.jQTouch({ | |
'icon': '/presentation/libraries/jqtouch/themes/mytheme/img/icon.png', | |
addGlossToIcon: true, | |
startupScreen: '/presentation/libraries/jqtouch/themes/mytheme/img/startup.png', | |
statusBar: 'black', | |
preloadImage: [ | |
//... | |
], | |
useFastTouch: false //allows us to do $().submit() on forms | |
}); |
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
//How can we make this one work with classes and tags? | |
function $(id){ | |
return document.getElementById(id); | |
} | |
function html(id, html){ $(id).innerHTML = html; } | |
function css(id, style){ $(id).style.cssText += ';'+style; } | |
//iPhone/iPad/iPod browser animations |
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
//if animations crash due to excessive tapping, refresh the page | |
var crashchecker = setInterval(function(){ | |
if ($(".current").length == 0) { | |
window.location="/"; | |
clearInterval(crashchecker); | |
} | |
}, 500); |
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 foreach($pages as $page) { ?> | |
<div id="<?php echo $page['slug']; ?>" <?php echo $user->uid && $_GET['t'] == $page['slug'] ? "class='current setcurrent'" : ""; ?>> | |
<div class="toolbar"> | |
<h1><?php echo $page['section']; ?></h1> | |
<?php if(isset($page['parent'])) { ?> | |
<a href="?t=<?php echo $page['parent']; ?>" class="parent">Back</a> | |
<?php } else { ?> | |
<a id="logout" href="/logout" class="button">Logout</a> | |
<?php } ?> | |
</div> |
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
// Add options to the end of a select | |
$("#myselect").append("<option value='1'>Apples</option>"); | |
$("#myselect").append("<option value='2'>After Apples</option>"); | |
// Add options to the start of a select | |
$("#myselect").prepend("<option value='0'>Before Apples</option>"); | |
// Replace all the options with new options | |
$("#myselect").html("<option value='1'>Some oranges</option><option value='2'>More Oranges</option><option value='3'>Even more oranges</option>"); |
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 | |
/** | |
* Themed attachments | |
*/ | |
echo "<ul class='attachments'>"; | |
foreach ($files as $file) { | |
if ($file->list) { | |
$type = explode('.', $file->filename); | |
$type = $type[count($type)-1]; | |
$href = check_url(($file->fid ? file_create_url($file->filepath) : url(file_create_filename($file->filename, file_create_path())))); |
OlderNewer