Profile
Achievement
halk's Recent Snippets
- All /
« Prev 1 Next »
This is a static session wrapper that handles single variables and arrays. It allows setting, resetting, and deleting session variables (without destroying the session). It regenerates the session id every time a session is started to prevent sessi...
0
913
posted 11 years ago by halk
PHP
HTML Helper Function Create Any Element With Any Number Of Attributes (self-closing and container tags)
/**
* THIS FUNCTION WILL RENDER A CONTAINER OR SELF-CLOSING HTML ELEMENT.
* IT AUTO DETECTS WHAT TYPE YOU WANT
* BASED ON RATHER OR NOT YOU SET A _data KEY IN THE ARRAY OF
* ATTRIBUTES PASSED TO THE FUNCTION
*
* USING AN ASSOCIATIVE ARRA...
0
971
posted 12 years ago by halk
https://gist.github.com/4098493
(examples of use below the class code)
This class allows you to load a file of snippets that are really mini-templates copy them from your repository fill the token slots in them the with your data and render them as...
0
1000
posted 12 years ago by halk
Does not require http in the text to link. It must start with www however. Optionaly make the links popup in a new window.
0
1283
posted 12 years ago by halk
This is a public jsonp api. I use it with jQuery Like This:
$.getJSON("http://yourdomain/yourpath/jsonp_api.php?method=getSchema¶ms=your_db_name&jsoncallback=?",
function(data){
//DO SOMETHING WITH THE DATA HERE
}...
1
1089
posted 12 years ago by halk
This function dosen't use curl, or any other libraries. Just include it in your function library and use it like this:
$Post_result = _post('http://www.yourdomain.com/your_path/post_api.php',"method=fetchJson¶ms=select * from user");
0
995
posted 12 years ago by halk
Any valid json object will be recursively traversed building a nested unordered list of its properties and their values. This example parses the json entered in the text area into an object that is passed to the json_tree() function. I use the twit...
0
1101
posted 12 years ago by halk
For some reason setting a default value for select elements does not work. This one line of jquery solves that problem. Assign a value (value="something") to the select tag that is to be the default value. With jquery get all select elements with a...
0
1452
posted 12 years ago by halk
This will monitor the status of all ajax calls on the page. When ajax starts i show an animated spinner gif and display a message that ajax has been requested. On completion of a call the status returned is displayed and the spinner is hidden to in...
1
908
posted 12 years ago by halk