phpfunk.com


php and javascript code reference

ajax library

I wouldn't touch ajax without a library. I'm not that crazy about wading thru the DOM with javascript. Someone else who really is crazy about that, fortunately, has already done the hard work. So far I've been using prototype and its awesome. Here are some sublimely simple ajax examples with the associated source code for the php server pages.

javascript character counting

I revised this javascript code that tracks how many characters user has typed in a field.

robot-friendly expandable navigation

You might take a look at this example and say there already exists lots of fancy javascript for doing this exact same thing. Or you could use ajax. The advantage of this approach is all the links are actually on the page and readable by robots. They are not hidden away in javascript.

php sessions and URLs

Purpose: remove trans SID from URL for XHTML compliance.
Example php code shown here, from mtdev.com article on removing trans sid from URL. Verify that you can actually set these values on the server where you host the php code; to date we found one instance where this was not possible.

ini_set('session.use_trans_sid', FALSE);
ini_set("url_rewriter.tags","");

Of course you call them before calling session_start().