Shagging Pandas
- Comments:
- here.
I just love this image: I can’t recall where it came from, but it makes me chuckle, each time I look at it. 
I just love this image: I can’t recall where it came from, but it makes me chuckle, each time I look at it. 
I’ve come across a couple of Smary Modifiers I want to have installed on Blogsome:
More available on: Smarty Plugins Wiki If there’s any more there anyone is interested in, leave a message and I’ll test them out. And then ask the admins to install them, if they work.
I couldn’t find a simple explanation of how to do this, so here is one. First, a bit of background. I wanted to be able to delete a comment from a standard post page, without having to a) go to a confirmation page, and b) have to navigate back to the original page afterwards. The following code creates an HTTP request, opens the required page, then fakes the header so it looks like it came from an admin page, before sending the request. When the request is complete, it refreshes the current page, so as to update the display.
|
|
A better option might be to just hide the deleted comment from view - that would be immediate, and if the user refreshed the page it would reflect reality.
|
|
However, if the user was to somehow cause the comment to become visible again, it doesn’t get it’s number back, at least in Firefox. There are a multitude of other ways to handle this case: .style.visibility = 'hidden' hides the object, but leaves the space. You could also delete the object from the whole DOM structure, using:
|
|
A bit down the track, I want to fix some things with the way Posts are parsed when they are created or edited using Blogsome. I’m loath to change too much the stuff in the actual edit box: people need to be able to put Raw HTML code in there if they want, and if they don’t, they can use the WYSI-editor. However, the Title field needs to be escaped before being saved to the database. Having an & in the title generates invalid XHTML code. This is basically the same issue as what causes the errors when extended (non-latin) characters are used in the title, and transferred into the post-slug. This should be fairly easy to fix: just a function that looks at this field on posting (and perhaps the post-slug field also, just to check), and replaces any invalid characters with the escaped version. I only thought about this again, as I had two posts with & in their titles in the past week.
Occasionally, people report a particular error when trying to delete posts or comments.
Sorry, you need to enable sending referrers for this feature to work.
I came across this twice in the past week. Once was when I changed my $siteurl variable, and this disappeared when I returned it to the normal value. The other was when I tried to set up a shortcut to delete a comment from the post page. The original shortcut was: {$siteurl}/wp-admin/post.php?action=confirmdeletecomment&comment;={$comment_ID} Which worked, but loaded a confirmation page. I replaced it with: {$siteurl}/wp-admin/post.php?action=deletecomment&comment;={$comment_ID} And made the confirmation a confirm dialog instead: return confirm("Delete Comment by {$comment_author}?\nThis cannot be undone.");, which is the way it is done in the Edit Comment page (not the Mass Edit though, I don’t think). This is when I received the error page. I think what is happening is that the referrer of the second page must be within the {$siteurl}/wp-admin/ domain for it to be accepted. I wonder if I can fake the referrer, and make it work. This also explains why the error appeared when changing the {$siteurl} variable, since it’s looking for a referrer and obviously getting the wrong one. Knowing this may help me to a fix so that I can change the {$siteurl} variable, and avoid the referrer errors.
Blogsome Search has never quite been right, and now I think I know how to fix it. At the moment, my Search code looks like:
|
|
This works, to a certain extent. It will only properly display the first page of results. It is possible to use URLs of the form: http://schinckel.net/category/?s=searchterm which will give results, and if there are more hits than are visible, will display the Next Page link, which is of the form: http://schinckel.net/category/?s=searchterm/page/2/, and works. Knowing this, it’s possible to hack up a JavaScript function that will display the search results, but the Next Page link still fails. You can, however, pop an &paged=n on the end of the URL, which will work in this case. I think this would be much nicer with a RewriteRule. I’ll have to play around a bit and see what makes a working one for .../search/term1/term2/, I think. The JavaScript I am using at the moment is (shown in context):
|
|
A Blogsome user wanted to use the URL switch ?order=asc to get an ascending list of posts by date. I suggested it would’t work, but they tried it in the form: http://schinckel.net/category&order=asc And it worked! It only seems to work for category pages, although I think the above URL will actually catch every post, as each post lives in at least one place within the /category hierarchy. This opens up huge opportunities to use other URL switches to get other effects under Blogsome. I’m off to the Wordpress Codex, to see what else I can use!
I Wasted Time • Paul Kelly • …Nothing But A Dream ★★★★

I was a bit peckish waiting for the train on Friday, so I bought a packet of chips. Smiths have a new flavour range out, including Australian Sausage Sizzle. They actually weren’t too bad. They did taste a bit like a sausage. I remember the good old days of the Roast Beef and Mustard chips. Derek and I used to have a packet of them every Sunday for lunch. And it was just like having a Roast Sunday Dinner. But easier to prepare.
Now that it’s possible to view which images have been uploaded to a Blogsome blog, and it’s possible to delete unwanted images, I’m going to go through and remove any unused images, and resize some of the larger images I uploaded a while ago. I’ve also found a way to upload any type of file: such as JavaScript.js, Python.py and AdobeAcrobat.pdf documents.
The adult version of the joke that “Babies are machines for turning milk into shit”: 