I have been familiar with Picora, the PHP framework written by the LivePipe team, but did not realize they also had written an extension for Prototype.js. It turns out they offer Prototype.Extension, which among other features offers these two gems:
- Cookie object: get, set, and unset browser cookies.
- Client object: find the browser, OS, and version of the client.
These are simple functions that we probably all have a generic reference bookmarked for, but it is nice to have them integrated into the library. Stumbling across Prototype.Extensions made me think about additional extensions. There seems to be quite a list of available extensions. Here is a small, slightly outdated list of what’s out there, and be sure to keep an eye on the official Built with Prototype collection.
On a similar but unrelated note, Prototype 1.5.1 is nearly complete. Tobie Langel shows us some of the magic with native JSON and window scrolling with the $$ utility.
Speaking of PHP frameworks, have you tried Code Igniter yet? It seems really nice to me, I’ve done a couple sites with it. Feels like PHP on Rails to be honest, though the scaffolding feature is a little less built up.
I’d be more then happy to update my list if anyone has any suggestions. I’ll add these tonight.
Just add comment to http://blog.samdevore.com/archives/2006/07/24/prototypejs-extensions/
Hey Sam, I only mentioned it was outdated because the original post date was about 9 months ago. I didn’t realize this was a list that you were actively maintaining. Sorry about that.
Hi Ryan,
Thanks for the link-love!
Note that there’s a lot more info on Prototype’s native JSON in a tutorial which I posted on the Prototype website.
Regarding Prototype.Extension, there’s some interesting ideas in there, but the browser sniffing is sketchy at best and the
Element.getElementsByAttribute
relies on the nativegetAttribute
DOM method, who’s support is absolutely horrible in IE. Prototype now has an inbuilt method (Element.readAttribute
) to deal with these discrepancies.Also note that, as the
$$
utility supports CSS3 selectors, this can already be done in Prototype like so:And yes, the Built-with-Prototype stuff is coming… sorry for the delay!
Not having gotten many suggestions, I haven’t updated it in a while either ;)
I probably should have mentioned it in the post, but I trimmed down the Prototype.Extension library quite a lot. I got rid of everything that wasn’t part of the Client or Cookie object. Browser sniffing is questionable, but I have found that in one or two occasions there is no other way around a problem.
Thanks for the other links and code. Wasn’t aware of those.
Ryan, a cookie object is definitely something that should be added to Prototype, maybe in an extensions lib. There’s also a new “secret” feature in 1.5.1… the
Prototype.Browser
object, which should provide for all the sniffing you need.Tobie, thanks for the Element.readAttribute note, I’ll update Prototype.Extensions. Also in regards to the Browser object in 1.5.1, once the final version is released I will definitely get rid of the Client object. I rarely use the version and OS attributes myself, I more put them in there for completeness.
I’m thinking of changing the name to Prototype.Tidbits as that more of how I treat it…