A blog is fast becoming a standard part of many web sites and many web providers offer free blogging software. At Cobblers, however, we like to roll our own. A home-brewed blog is easier to integrate into the site and can be more easily adapted for different requirements.

The most interesitng part - the online editor - is hidden behind a login, so unfortunately you cannot see it. It uses the excellent CKEditor which is free to use for non-commercial sites, and a bargain to purchase if you want to use it on a site which earns money.

If you really want to have a go with it, there is a demo on the CKEditor web site.

The backend is mySQL with some simple PHP to manage the data entry and retrieval.
I'll have to add some filtering once the number of entries gets past 10 or so, but I'll cross that bridge when I come to it. Should not be too hard. Actually the software is easy - it's getting the user interface right which is the difficult problem.


File Name Change   

Posted On: 2012-01-27 12:00:36

Making sure we never get a duplicate photo name

The upload scheme for picture files is simple. They   just get parked into a folder. There is no database entry (yet). So it's possible that two people with the same type of camera, and hence the same file naming scheme could both try and upload and save a file like IMG_1234.jpg. So they get renamed to unixtime.jpg for example. This  guarantees the names will always be different.

Later on I will add a proper filing scheme for the pictures, so that they can be correctly identifed. Thus it will be possible to delete them when an article is deleted, and also make thumbnails which can be used for the pick list.

OK - that worked. The picture left me as salzburg.jpg but is stored as 1327665655.jpg

 


Halloween's   

Posted On: 2012-01-22 12:08:54

And another problem or two's

Making a halloween face from a pumpkinHaven't used this for month's. Wanted to use it on a live site, so it seemed a good idea to post an article or two to refresh my memory on how it all works and hangs together

Shock and Horror  #1: When I came to upload this picture I got a "file too big" error. (It's 3,8Mb in original form). Reduced it to 50kB and uploads OK. The maximum size you can upload is set in php.ini and on a shared server you can't twiddle it yourself. I've EMailed my host asking what value they use by default and if they will make it bigger.

I'm sure I went through all of this a couple of years ago on the same host - but it's too long ago to remember what happened.

More news later when I have heard from my hosting company. Ah - here it is... I remembered what the fix is just after I posted them a help ticket....run the site using phpFast CGI which you can install yourself.

Shock and Horror #2. Then I came to another problem which was a bit trickier . Whenever I came to save something which had an image in it, the modsecurity module on my host's Apache server  kicked in, denying me access and locking me out for an hour. This made it hard to troubleshoot.  I'm sure it didn't do this when I first installed this editor.

The clue was in the server  logfile - it was the contents of the form field which contains all this stuff which had spooked it - probably the border width=1 parameter in the  image tag. I passed the info to my hosting company and they did two things for me (1) Helped me carry on with the development by putting my IP on a white list until the problem was resolved , and (2) Asking the company which provides the security module to adjust their rules. This is still going on at the moment (27 Jan 12) but I'm certain it will get resolved.

So many thanks my host 34sp.com for sorting this out. They are the bees knees in my opinion.

 

 


HTML5 and CSS3   

Posted On: 2011-03-07 09:47:36

The Next Best Thing - but still waiting for the browsers to catch up

If you are viewing this using Google Chrome, then the HTML5  picture (like the others in this blog) will have rounded corners, courtesy of CSS3.

If however you are using IE - even the very latest IE9 - you will not see them. Firefox does not do rounded corners either. It's a bit like the bad old days between about 1995 and 2000 when every variety of browser did something different with HTML markup and desigining webpages which worked  with all of them was a most frustrating job.

Let's hope that by the end of 2011 all the major browsers will support CSS3.


Clive New   

Posted On: 2011-03-05 16:45:05

Clive in his favourite position - behind a pint of beer

Here's a picture of Clive New, the founder, leader and musical adviser to the Maryland Jazz Band. It was taken in June 2005 at the West Tytherley Village Show. Clive  died only a few months after this picture was taken and  I still miss him. It does not seem possible that it was nearly six years ago.

The MJB were playing at West Tytherley ( it's near Romsey, Hampshire ) that day. What a great place - so far out in the sticks that no-one's mobile phone worked. Maybe they have put in another cell since then.

Clive's principal was that there was only one way to do anything - HIS way, and he could be very irascible when applying it. But he never held a grudge and had a lifetime's experience in music, so most of what he said made a lot of sense.

My first small band gigs were done with him and he offered much encouragment and support in the early, frightening days ! 


Inserting and Uploading images   

Posted On: 2011-03-04 16:53:18

Discovering how to upload images and insert them

Here's a photograph of the album sleeve of  one of the LPs I used to play a lot. The late George Melly was a man who lived life in his own, special way and brought a lot of fun into the lives of people who watched him doing it !

Anyway, it's here because this is the first picture I have uploaded from within the editor, using code I wrote myself for the file uploader and for the file browser. The missing link - how to callback the editor from the file browser with the url of the picture you want to insert,  was supplied by a chap called Don Jones, and you can find the details here. His method worked first time without any twiddling being needed - so thanks Don. The ckeditor Developer documentation has nothing to say about this vital link - perhaps they want you to buy their file browser/uploader.

So that's all the pieces in place now to make a proper blog. Just need to tidy up the file browser a bit and we are good to go..


Heres one with a picture   

Posted On: 2011-02-21 18:14:30

In which we insert an image

Having problems with the image insertion. When you choose an image a pop-up appears and you use this to choose your pic. So I choose my pic then click OK on the pop-up. The pop-up disappears, the image is inserted into the edit area, but the browser window does not regain focus. So cannot click anything ! The only thing you can do is refresh the page...and so you lose all your changes - including the image - because you cannot click "Save".  This is an interesting problem !

More on this later

OK - I fixed it. I was using a PHP script to initiate the editor instance - as shown in the developer documentation. I tried it in different parts of the page, including right at the very end, just before the body tag, but it made no difference. Once the dialog for the picture insert  had been displayed, focus would not return to the browser window.

Then I tried the javascript initiator - and no problem, it worked straight away. So that's the way to do it. There's no technical reason why it has to be PHP initiation. 

A few more things to add to this. It would be useful to have an alert if you try to refresh the screen or leave it, when there is unsaved work in the editor. It's easy to forget to save  -  then 10 minutes work has gone. And the text in the Title and Strap input boxes needs to be escaped for quotes. Righ now, typing something like "it's" in either of those two boxes will crash mySQL.  Then we have to get the uploader working, so that I can upload images. Finally we need to try CKFinder - a file browser which works on your web site - how neat is that - so you don't have to remember the names of images. Finally - Ajax for the div which contains the editor.