Updated Widget

The server hosting the script to display buttons is behaving a bit strangely, so I’ve had to update the Widget script to default to javascript if the standard readfile command returns a null result.

The updated version can be found here.

Author: Martin Tod

Martin Tod is a marketing professional and Liberal Democrat living in Winchester.

3 thoughts on “Updated Widget”

  1. Martin, I might be wrong but I think that new code is lacking an “else” statement. From the look of it, it returns the JavaScript if the result is empty but doesn’t display the readfile code if it isn’t as there’s no “echo $result;”.

  2. My intention was that the readfile command should display the code as soon as it was called, although admittedly, I’ve not used it with an = sign before it before so it may no longer work.

    Only if readfile failed or returned a zero result for some other reason would the javascript be displayed.

    But I’ll go and play with it and see if it works properly.

  3. Ah, I see – the contents of the readfile command display even though it’s set equal to a variable. I’ve done a quick test and that certainly seems to be the case. You learn some useful new PHP every day 🙂

Leave a Reply