Archive for February, 2003

Move and resize browser window…

Thursday, February 27th, 2003

To move a browser window to a specific location on the users screen:

window.moveTo(x,y);

replacing “x,y” with pixel coordinates.

More info here, where they also have the below which will give you the users screen width, height:

screen.width
screen.height

Also, to resize the browser window:

window.resize(width,height)

Now, before you go all crazy on me - I’m not suggesting people do this for sport on their blogs. Messing around with people’s browser’s sizes, position, etc. will be annoying and NOT very usable. The reason why I needed the code above was to create a “minimize my browser” type effect with a bookmarklet for my mac (aka. “hide! the boss is coming”). The end result is this: mini-me

Online Tools

Wednesday, February 26th, 2003

Thanks to a recent trackback ping from this post on electrosketch.org I found this site: onlinetools.org

Among many other cool things, they also have a php counter, and they posted a cool bookmarklet to put a bunch of image info into the “alt” tag, and (this link from electrosketch) a php newsletter manager

Simple php counter

Wednesday, February 26th, 2003

I’ve had a few requests for a simple php counter that doesn’t use mySQL. php-princess has one here.

(While you’re there - poke around that site - lots of neat stuff there)

Get first (part of) name

Wednesday, February 26th, 2003

(non blog related post) Needed to use this php function: strchr (alias to strstr).

I had a field that had a person’s full name (first and last). 99.999% of the time, the first name and last name were seperated by a space (no Mr. or Mrs. in there) and I needed a script that assumed as such and grabbed what was more than likely the person’s first name. I found the script below on that strchr function page.

<?php
$fullname = $row['customername'];
$toFind = ” “;
echo str_replace( strchr($fullname, $toFind), “”, $fullname );
?>

so if $row['customername'] was “Jane Smith”… the script above would return just “Jane”

Archive Redirects made (more) simple

Tuesday, February 25th, 2003

A few weeks ago, Kristine posted about Redirects in MT, and this got me thinking. I had already looked at an archive mapping solution which was recently updated, but it required that I have access to the server config files (not just a .htaccess file) because a RewriteMap can only be defined in the server config files.

So tonight when I decided, after a great deal of pondering (about 10 minutes), to change my archiving format to something that didn’t produce 1000+ numerically named directories I needed a way to map the archive numbers to their new named location. Here is the solution I came up with, based on some modifications of the pre-existing code.

First download mt-archivefinder.cgi and rename it to mt-archivefinder.cgi (or any other name that suits your purposes). Put it in the MT directory.

You will need to change a couple of the lines at the top of the file to match your server’s configuration. Make sure to chmod the file 755.

Next you will need to do some mod_rewrite mojo with a .htaccess file. Create a .htaccess file or edit the existing file in the root of your archives directory. To that file add:

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/archive/[0-9]{6}.html
RewriteRule ^(.*).html$ /mt/mt-archivefinder.cgi?$1

You will need to change it to reflect your path structure. If all goes well, you will be automagically redirected from any numbered file like /archives/000001.html to whatever new archiving scheme you enter into the individual archive template in the Weblog Config panel in MT.

For example, I was using

<$MTEntryID pad=”1″>/index.php

and now I’m using

<$MTArchiveDate format=”%Y”$>/<$MTArchiveDate format=”%m”$>/<$MTEntryTitle dirify=”1″$>/index.php

I used the following mod_rewrite rule to automatically forward all links to the old archive style to the new archive style.

RewriteCond %{REQUEST_URI} ^/history/[0-9]{6}/
RewriteRule ^(.*)/$ /mt/mt-archivefinder.cgi?$1

That’s all it takes!

Many thanks to Alex for the inspiration and the code.

closing comments on old entries

Sunday, February 23rd, 2003

Tubedogg at Geeksblog put together a PHP script for MT which will close comments on old entries based on a date/time: Close Comments. Requires MT 2.6 or higher running the MySQL backend. There’s been a lot of requests for this type of thing at the MT Forums in the past, and now that MT2.6 has the option to close comments instead of just having them on or off, this is possible :)

Lazyman’s smilies…

Sunday, February 23rd, 2003

One of the reasons I had taken smilies off my site was because I didn’t like the look of all these smilies on my comment form. Pruning my list of smilies was difficult, but the more smilies I had, the more “messy” the form. Also, with tons and tons of smilies, that meant writing a TON of code to make each one “clickable.” Well, I think I’ve come up with a solution…

This script will launch a “smilie palette” that will update the comments form on the “parent” window with the smilie.

To take it one step further, I also created a php script that will load all the images from your (smilie) folder on the page… so you can have as many smilies on that palette as you can fill in your folder, and you don’t have to sit there writing the code for each one as noted in the original javascript smilie script.

(also - a side note: Jason’s (of Jason’s Smilies) moved. Please update your bookmarks.)
(more…)

Live Preview and Smilies

Sunday, February 23rd, 2003

Oscar Hills put together a tutorial at the MT Forums about using the Live Preview script from over here together with clickable smilies which show up in the Preview. With all the talk about smilies lately, I thought it was worth linking over here too :)

Photoshop tutorials

Friday, February 21st, 2003

Ok, the truth’s out - I’m GeekGrrl’s personal stalker. (No, just kidding!) But she has been posting some very neat stuff.. so here’s another link I’m stealing from her:

Some very cool photoshop tutorials

All about the smilies…

Friday, February 21st, 2003

GeekGrrl recently added smilies to her site, so it inspired me to make a post all about smilies. First a few smiley sites (Feel free to post others if you got em):

Jason’s Smilies [from GeekGrrl - these are the best I've seen]
abestweb [downloaded these so long ago, I can't remember where I got the link!]
smilies.nl [my fav: devil.gif ]

Now how to get them into your site:
We have a one here on scriptygoddess
Girlie has another version
And so does Unix Gal [this is the one GeekGrrl used]