how to get facebook authorization token for http posts
Jan0
make a page and paste the code below in, you need to provide an app id. After that you have a variable containing your facebook token for doing http posts to the graph. yeeaaa!!
<html>
<head>
<title>Client Flow Example</title>
</head>
<body>
<script>
/*
function displayUser(user) {
var userName = document.getElementById(’userName’);
var greetingText = document.createTextNode(’Greetings, ‘+ user.name + ‘.’);
userName.appendChild(greetingText);
}
*/
function get_token(){
alert(”token = “+window.facebook_token);
}
// var appID = “YOUR_APP_ID”;
var appID = “296325090405460″;
if (window.location.hash.length == 0) {
var path = ‘https://www.facebook.com/dialog/oauth?’;
var queryParams = ['client_id=' + appID,'redirect_uri=' + window.location,'response_type=token'];
var query = queryParams.join(’&’);
var url = path + query;
myWindow=window.open(url);
}
else {
var accessToken = window.location.hash.substring(1);
var path = “https://graph.facebook.com/me?”;
var queryParams = [accessToken, 'callback=displayUser'];
var query = queryParams.join(’&’);
var url = path + query;
// use jsonp to call the graph
var script = document.createElement(’script’);
script.src = url;
document.body.appendChild(script);
//var token = document.createElement(’token’);
//window.opener.appendChild(token);
//window.opener.document.write(”<span id=’token’ >”+accessToken+”</span>”);
//window.opener.document.write(”<span id=’token’ style=’display:none’>”+accessToken+”</span>”);
window.opener.facebook_token=accessToken;
window.close();
}
</script>
<p id=”userName”></p>
<a onClick=”get_token()”>show me the token</a>
</body>
</html>
fixed footers in jquery mobile
Nov0
how to get a fixed footer in jquery mobile with ajax page transistion still working. Hope this helps someone it took me a while. view source to see whats in the script tags below
working example: http://publichotels.ideawork.com/chicago/mobile/
what you need to do
1) auto hide the url bar ( for iphones )
2) add jquery mobile scroll view, you can get new copies from github but these have my option settings
" "
3)disable scrolling on the footer
//remove touchmove so you cant scroll the footer
$(document).bind("touchmove",function(event){
event.preventDefault();
});
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
4) add data-scrole=”true” to the div you want to scroll ie the conent body
add php code coloring to different file extensions cs5
Aug0
in cs5 the code coloring declarations are in your user data not in dreaweavers program directory add the extensions here:
“C:\Users\YOUR USER NAME\AppData\Roaming\Adobe\Dreamweaver CS5.5\en_US\Configuration\DocumentTypes\MMDocumentTypes.xml”
php insert string into a string
Apr1
$string = “picture.jpg”;
$new = “_new”;
$pos = “.jpg”;
echo str_replace($pos, $new.$pos ,$string);
mysql inner join 4 tables example
Apr1
from sites inner join sensors inner join fields
on sites.site_key = sensors.site_key and sensors.sensor_key = fields.sensor_key
inner join user_sites_field_preferences
on fields.field_key = user_sites_field_preferences.field_key
where user_sites_field_preferences.user_site_field_preference_key = 54 = $key “;
php get file names in a directory
Dec1
This function simply returns an array containing a list of a directory’s contents.
function getDirectoryList ($directory)
{
// create an array to hold directory list
$results = array();
// create a handler for the directory
$handler = opendir($directory);
// open directory and walk through the filenames
while ($file = readdir($handler)) {
// if file isn't this directory or its parent, add it to the results
if ($file != "." && $file != "..") {
$results[] = $file;
}
}
// tidy up: close the handler
closedir($handler);
// done!
return $results;
}
?>