The other day I had a new book sent to me called PHP Team Development, written by Samisa Abeysinghe and published by Packt Publishing. Unfortunately, it arrived at work when I was on holiday so I haven’t been able to have a look at it yet. :-/ However, I’m back today and have the book in my hands (well, not literally, of course, else typing would be much more difficult), so am looking forward to diving in to it.
Hopefully have a bit of a review posted up here some time soon!
Sometimes you come across hidden little gems in the Zend Framework that save you time, even if that’s just down to the amount of text you need to type. The Zend_View holds one of these little gems…
Did you know that you can use the short php open tags and echo tag in your view scripts, and you don’t even need to have this turned on in the php.ini file?
So you can have things like:
<? $this->viewHelper(); ?>
and:
<?= $this->variable; ?>
instead of:
<?php $this->viewHelper(); ?>
<?php echo $this->variable; ?>
Might not seem a lot, but when you have a lot of view scripts to write then you can save quite a few key strokes.
It’s able to do this, even if you have short_tags off (as it should be!) because Zend_View uses a stream to open and seek through the view script – Zend_View_Stream.
On creating a rather large form recently, I was in the need to have some kind of hint to the user about what format the content should take on several input boxes. I could have done this with a description under the form element, but a more accepted way to do this, it seems, is to have a ‘hint’ in the element itself. You know the kind of thing I mean; a value, usually quite a light grey colour, that is present until you click in to the form element and then is disappears. I also wanted to do this as a jQuery plug-in because, well, why not?
Continue reading ‘Text box ‘hint’ values with jQuery’
I think we can all agree that URL shortening services are great and are very handy to tidy up those long and obnoxious links. However, a lot of the time people simply forget to use them, or often don’t know about them in the first place. I’ve noticed this in a blog system I wrote using Zend Framework. On one hand I love that people post messages, but on the other it annoys me that they may supply a link that is so long it breaks the formatting of the page, or looks just plain ugly.
So what are my options? I could train everyone who posts blogs on the system to use a url shortening service or I could manually tweak all the links myself. As solutions they are not very practical at all; I don’t have the time to change any/all links myself, and I certainly don’t have enough patience to train everyone! So an automatic way of doing things is needed, and the filtering in Zend Framework comes to the rescue!
Continue reading ‘Shorten urls automatically with a Zend Framework filter’
Tonight at 11:31 and 30 seconds (GMT) it will be exactly 1234567890 in unix time. Cool, eh?
I came across a jQuery plug-in the other day to sort tables, and it works great and is exceptionally simple to implement (and as anyone who’s flicked through this blog knows, I like the simple things in life… Don’t need any more gray hairs popping up, you know!).
The plug-in is called tablesorter (found at tablesorter.com), by Christian Bach.
Continue reading ‘Easy table sorting with jQuery’
A little while ago I posted a quick jQuery plug-in that allows you to easily indicate an external link. Then I posted an updated version that had a few optimizations. Well, it turns out that I had missed out a rather important portion of the code when I posted it up. D’oh! So here’s the full and working version.
Continue reading ‘Highlight external links with jQuery’
Somethings it’s the simple things in life that make you really happy. For me yesterday, that was thanks to jQuery. Have you ever wanted to have a check box that, when the user checks it it also checks a lot of other checkboxes? Yeah, of course you have! I wanted to do that yesterday. Now, it’s not the first time I’ve had to do that kind of functionality, but it always came with a bunch of javascript that seemed over the top for what was wanted. With jQuery it just took a line or two of code!
$(document).ready(function() {
$('#selectall').click(function() {
$(":checkbox", $('#checkboxlist')).attr('checked', $(this).is(':checked'));
});
});
And with that, on and off go the other checkboxes.
Marvelous!
Published on
January 1, 2009 in
General.
Hope everyone has a wonderful new year!
Published on
December 9, 2008 in
General.
Screen shot of an error message I got from a popular MySQL interface.

?!
Recent Comments