Archive: PHP

A PHP 301 Redirect

Posted on Monday, May 14th, 2007

A friend pointed out recently that the subdomain my tests and examples are kept on had no index page in the root, so if anyone removed the page name from the address they could access my entire directory. I didn’t think that this was a good idea, so I decided to change it. I could have added an index.html file or something else there to protect the directory, but I wanted to link it in with the rest of the blog and learn something at the same time.

I created a page on which I could display all of my tests and examples, it’s the Test Centre that you can find linked above now. As a page in my blog, it is part of the main domain, so how do I connect the subdomain http://test.unintentionallyblank.co.uk to the page http://www.unintentionallyblank.co.uk/test-centre/?

Continue reading “A PHP 301 Redirect” »

When Even The Internet Is Against You

Posted on Friday, April 20th, 2007

This week I produced a relatively simple bit of code for someone to use on a few websites. All I wanted to do was take a contact form that I had already written, simplify it, comment it and send it on. Sounds easy, why wasn’t it then?

I learnt the PHP for creating a contact form last summer. It is one of the obvious things to do first as a contact form is a standard occurrence on any site. After gathering the information from the HTML form all that is really left to do is create the following line:

mail($to, $subject, $message, $headers);

Having completed this, I uploaded a test and tried it out, visited my email account to see the test email arrive and… nothing! I checked and re-checked the code. I eventually found that I had a typo in one variable name, but that wouldn’t have stopped the message being sent, just not deliver any message. Minutes and hours of tinkering and looking on in disbelief with the occasional test passed. Eventually I received an email!

Continue reading “When Even The Internet Is Against You” »

First Go With The DOM - Changing Font Sizes

Posted on Wednesday, August 2nd, 2006

While this post has some interesting JavaScript in, there are also a lot of mistakes. Please have a look at fontSizer v2.0 which is much, much better!

Accessibility matters. I am trying to make this site as accessible as I can in order to learn the methods and set an example. My most recent task has been to add the links you will see at the top right of the page, links to increase or decrease the font size. Initially I searched for a quick bit of code to do this, but none of the results gave me exactly what I wanted, so I decided to do it myself, thus immersing myself in the DOM for the first time.

My requirements were a script that changed the text size on a page without loading a different stylesheet or forcing a reload and that once the text size was altered this would persist throughout the site. I also wanted to continue using relative font size attributes (this site’s font sizes are all done using ems so that IE users may resize using the browser controls). My searches found scripts that changed pixel sizes and only worked for the current page, so I got to work.

Continue reading “First Go With The DOM - Changing Font Sizes” »