Friday, 26 November 2010

Finally - embed yoube clips with valid HTML

Its easy, bot my invention or discovery, but I can no longer ind the source.

Anyway, this is how you do it:

< object type="application/x-shockwave-flash" data="[INSERT VIDEO URL FROM EMBED CODE PROVIDED HERE]" width="400" height="326">
< param name="movie" value="[INSERT VIDEO URL FROM EMBED CODE PROVIDED HERE]" />
< param name="FlashVars" value="playerMode=embedded" />
< /object >


That's all there is to putting a video or slideshow from www.youtube.com into your pwn valid html.

Wednesday, 24 November 2010

Forms not submitting from an iframe (IE8, IE7)

So, we had a login system that was written in PHP.

The parent site got moved and so for reasons we can't remember, the site got a new URL. We then ended up putting the login system in an iframe...

... and the login stopped working in IE7 and IE8.

The solution is a simple header line at the top of the page inside the iframe:

<?PHP
header(‘P3P: CP=”CAO PSA OUR”‘);
?>

What this does is let IE retain the cookie/session information rather than start a new one each for each page.

Thursday, 11 November 2010

Google Does not Use Keywords

Its pretty clear - please check out this link if you are in any doubt about your SEO stratgey:

Google Webmaster Central

Tuesday, 9 November 2010

Manually Install SSL Certificates

So - you have a domain ready to go, you have paid verisign for their seal of SSL approval.

How and where do the files go?

First off, you need to generate a certificate request, which should give you a .csr request file and also a private.key file (or the ascii text that goes inthese files). The 2 files go to verisign where they generate an SSL certificate key, which is typically emailed back to you.

You will also need to get the appropriate Verisign 'Intermediate CA Bundle' which is normally flagged up in the email you receive when you purchase the certificate.

Now place the 3 files in to a nice, safe bit of your host, something like:

/home/[MY-DOMAIN\/user/cert/public.crt (the one you get from verisign)
/home/[MY-DOMAIN]/user/cert/private.key (the one you generated at the start of the process)
/home/[MY-DOMAIN]/user/cert/intermediate.key (downloaded from the verisign site)


Now you need to edit the host settings for your host (which are normallyin your vhost.conf file) Somewhere in your block, you need to add/edit:

# Begin SSL Config SSLCertificateFile /home//user/cert/public.crt
SSLCertificateKeyFile /home//user/cert/private.key
SSLCACertificateFile /home//user/cert/intermediate.crt
# End SSL config

Now, save the updated vhost.conf file and restart apache:

> service httpd restart (for Centos and linux users)

Monday, 8 November 2010

Javascript based Flickr slideshows

There is only one way to to: phpflickr.com However, if you know a little simple XML, then php has everything you really need already built in... More to follow when its tested.

Thursday, 4 November 2010

Conditional CSS files for IE6, IE7, IE8 ...

So I just always lose this bit of code. Its not ideal, but works perfectly.
< !--[if IE 6]>
padding: 0px 20px 6px 2px;
< ![endif]-->

Thomas Cook Travel Rewards

Just gotta check out our latest site: http://www.thomascooktravelrewards.co.uk Love it, read it, bookmark it!

Wednesday, 3 November 2010

PHP While Loop

It's a straight forward thing, once you've got it kept somewhere safe:
$i=0;
while($i<=35) {
echo ("The number is $i < b r />");
$i++;
}


Do whatever you need to with the incrementing value of $'i'

Monday, 1 November 2010

Get All Posted Variables and Set As PHP Strings

So, A quick starter for today - we use this practically everyday. First off, if you are using forms in html code, give the inputs meaningful names. To capture the variables in the target page, use the PHP below :
<\?PHP
// get single, named posted variables from previous web page
if (isset($_REQUEST['username'])) {
$username = $_REQUEST['username'];
// you may prefer to have addslashes() in here...
} else {
$username = "default";
}
?>

Each input variable will now be a meaningful PHP variable of the same name.
More to follow - with escape characters and arrays too...
But, how about this for simplcity:
//
// parse the $_REQUEST vars
foreach($_REQUEST as $varname => $input) {
${$varname} = $input;
}
Now ANY and ALL variables posted will be set up for you to use as you wish!

Blog up and running

Hey everyone!

The blog is now up and running. The aim, as much as anything, is to share the bits and pieces of code and hints that we find useful - everything we put up here is free to be used by anyone - unless otherwise stated - which should be pretty unusual.