Change the page that the blog displays on

October 22, 2012 Leave a comment

SETTINGS –> Reading –>

Categories: WordPress

Remove search box from main nav menu

October 22, 2012 Leave a comment

Remove search box from main nav menu:

Go to ‘Appearance > Editor > Header (header.php)

Find the following close to the end:

<?php get_search_form(); ?>

Remove it, or, replace it with the follow:

<!– <?php get_search_form(); ?> –>

Categories: WordPress

focus() in Firefox

September 26, 2012 Leave a comment

You have to set a little delay in the focusing of the field.

setTimeout(function(){field.focus()}, 10);

I found this from at http://www.codingforums.com from a user post.

Categories: JavaScript

Javascript not inline

September 12, 2012 Leave a comment

window.onload = function()
{
document.getElementById(‘div1’).onclick=readPage;
}
function readPage()
{
alert(‘test’);
}

Categories: JavaScript

CSS3 IE ie-css3.htc

September 7, 2012 Leave a comment

 

CSS3 support for Internet Explorer 6, 7, and 8

 

What is it?

 

IE-CSS3 is a script to provide Internet Explorer support for some new styles available in the upcoming CSS3 standard.

 

How it works

 

If you’re viewing this page in Internet Explorer, some of the elements have been rebuilt by the script in Vector Markup Language (VML), an IE-specific vector drawing language. VML supports things that are missing from IE’s CSS implementation like rounded corners and blur effects.

 

How to use it

 

Just add CSS styles as you normally would, but include one new line:

 

.box {
  -moz-border-radius: 15px; /* Firefox */
  -webkit-border-radius: 15px; /* Safari and Chrome */
  border-radius: 15px; /* Opera 10.5+, future browsers, and now also Internet Explorer 6+ using IE-CSS3 */

  -moz-box-shadow: 10px 10px 20px #000; /* Firefox */
  -webkit-box-shadow: 10px 10px 20px #000; /* Safari and Chrome */
  box-shadow: 10px 10px 20px #000; /* Opera 10.5+, future browsers and IE6+ using IE-CSS3 */

  behavior: url(ie-css3.htc); /* This lets IE know to call the script on all elements which get the 'box' class */
}

 

Issues and Workarounds

 

You would expect URLs in behavior: url(...) to be relative to the current directory as they are in a background-image: url(...) style for example, but instead Microsoft decided to ignore standards here and make them relative to the docroot instead. So behavior: url(ie-css3.htc) should work if ie-css3.htc is in the root directory of the site.

 

You will probably run into issues with z-index, especially if embedding one IE-CSS3 enabled element inside of another. There are two simple workarounds:

 

  • Set the z-index of the IE-CSS3 element to a number larger than its surrounding elements.
  • Make sure the IE-CSS3 element is positioned, such as with position: relative or position: absolute

 

Sometimes an IE-CSS3 element will show up at a slightly different position than the original, untouched element. There could be a few reasons for this:

 

  • You have broken tags somewhere in your markup, probably above the IE-CSS3 element.
  • You are experiencing misc IE6 and IE7 bugs. Try adding the styles zoom: 1 and/or position: relative to the IE-CSS3 element and its immediate parent. You could also try removing any margins on the IE-CSS3 element and/or its parent, use padding instead.

 

Styles and their status

 

Style What works What doesn’t work
border-radius
  • Setting a radius for all four corners
  • Element borders
  • Setting a radius for individual corners separately
box-shadow
  • Blur size
  • Offset
  • Any color other than #000
text-shadow
  • Blur size
  • Offset
  • Color
  • The shadow looks a little bit different than it does in FF/Safari/Chrome, I’m not sure why

http://fetchak.com/ie-css3/

Categories: CSS3

PHP Security Guide

August 28, 2012 Leave a comment

I can never read too many of these.

This guide aims to familiarise you with some of the basic concepts of online security and teach you how to write more secure PHP scripts. It’s aimed squarely at beginners, but I hope that it still has something to offer more advanced users. Enjoy.

r@robm.me.uk

http://php.robm.me.uk/

Categories: PHP

PHP crypt() – Using PHP encryption methods

April 3, 2012 Leave a comment

I had not done any user registration type stuff in the past and needed to figure this out. I wanted to store an encrypted password in a database, and then be able to compare a submitted pw at login.

I tried using crypt() and it did successfully store the encrypted password in the db. Then I need to be able to compare it to form submitted pw to let the user login. I tried to just encrypt the submitted pw the same way, but this didn’t work.

There is a second “optional” argument (salt string) for the crypt() function, but for my purposes, this was required. I used the salt method described on the site below and it worked like a charm. I can’t pretend that I understand exactly how the salt works, but it does.

I found the solution here: http://php.ss23.geek.nz/2011/01/12/Using-crypt.html

$Salt = uniqid(); // Could use the second parameter to give it more entropy.
$Algo = ‘6’; // This is CRYPT_SHA512 as shown on http://php.net/crypt
$Rounds = ‘5000’; // The more, the more secure it is!

// This is the “salt” string we give to crypt().
$CryptSalt = ‘$’ . $Algo . ‘$rounds=’ . $Rounds . ‘$’ . $Salt;

$PASSWORD = crypt($PASSWORD_REG,$CryptSalt);

Categories: PHP, PHP/MySQL Tags: , , ,

Cross-Browser Inline-Block

December 19, 2011 Leave a comment

Does it seriously need to be this hard to do what seems to be a simple thing?

display: inline-block is really a cool thing, or is it?

http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/

Categories: HTML/CSS

JavaScript: change CSS

November 4, 2011 Leave a comment

This is a simple script that will change the CSS of any object.

You send the function the ID, the CSS attribute you want to change, and the value..

I actually struggled a bit with this as using dot syntax for the CSS attribute would not work. I had to use brackets.

<div id=”myDiv” onclick=”CSS_change(‘myDiv’,’color’,’#ff0000′)”>Change Color</div>

function CSS_change(ID, CSSATTRIB, VALUE)
{
    var obj_style = document.getElementById(ID).style;
    obj_style[CSSATTRIB] = VALUE;
}

Categories: JavaScript

setAttribute(“class”…… does not work in IE9

June 27, 2011 Leave a comment

This does not work in IE9:

var button_div_container = document.createElement(“div”);
button_div_container.setAttribute(‘class’, ‘button’);

You must do it this way:

var button_div_container = document.createElement(“div”);
button_div_container.className = “button”;

WTF?

Categories: JavaScript