Archive for November, 2002

Wording based on time

Wednesday, November 27th, 2002

Would you like to have a different saying below your post based on what time it was posted instead of (or in addition to) the date? A poster on the MT forums did, so I cooked up this little script yesterday.

<?
//set the beginning time for each time section - keep the quotes in there
$earlymorn = strtotime(”4:30am”);
$midmorn = strtotime(”9:00am”);
$lunch = strtotime(”11:30am”);
$afternoon = strtotime(”1:00pm”);
$evening = strtotime(”5:00pm”);
$bedtime = strtotime(”9:00pm”);

//This date format is for MT2.5 and above
$t = strtotime(”<$MTEntryDate format=”%X”$>”);

//Modify the messages as necessary - note that the middle of the night one should be in there twice.
if ($t <= $earlymorn) { echo “Past Your Bedtime”; }
elseif ($t <= $midmorn) { echo “Early Morning”; }
elseif ($t <= $lunch) { echo “Mid-Morning”; }
elseif ($t <= $afternoon) { echo “Lunch time”; }
elseif ($t <= $evening) { echo “Afternoon”; }
elseif ($t <= $bedtime) { echo “Evening”; }
else echo “Past your bedtime”;
?>

Enjoy! :)

IP blocking and custom 404 & 403 with htaccess

Tuesday, November 26th, 2002

This is old news, but because I’ve often needed to look for the exact syntax, I’m putting it up here.
(more…)

Add “Listening To” & other fields to your entries

Wednesday, November 20th, 2002

This is a hack that reminds me a lot of “LiveJournal” blogs, and I know many MT users long for it.

So, Scott has made the hack. This one is not for the faint of heart, but it looks very snazzy when you are finished.

Read Scott’s Tutorial here.
BTW, you must be using the mySQL database flava of MoveableType to use this tweak.

6 months of archives

Tuesday, November 19th, 2002

Heather asked me if it were possible to make your archives listing only show the last 6 months one way, and then the rest another way.

She wanted the last 6 months of archives to display like:

November 2002
02 Nov 19: post title
02 Nov 02: post title

October 2002
02 Oct 30: post title…

and then the rest of the archives just in month format like this:

April 2002
March 2002

At first I would have said to do something with <MTArchiveList archive_type-”monthly” offset=”6″> but it that “offset” attribute doesn’t seem to get applied like that (it only offsets specific ENTRIES, not archive types). So I made a very (kind of scary) script to do exactly what she wanted. There may be some shortcuts I’ve overlooked, so please let me know if you think there’s an easier way.
(more…)

Link, Bold, Italic links in comment text area

Monday, November 18th, 2002

Someone requested the code for how to do that “Link”, “Bold”, and “Italic” shortcut links in the comments section. I first saw it on Dawn’s blog sometime ago, and actually, the code in the MT-Entry template is very similar. In either case here it is:
(more…)

mySQL statements - order by and group by

Friday, November 15th, 2002

Anyone out there know mySQL really well? I understand what order by does, and I understand what group by does. Can these two be used together? If so, how does it work? Does it group stuff together and then WITHIN the groups do the order_by? ie. If we had a database of people’s info - and we did:

SELECT lastname, age FROM people GROUP BY lastname ORDER BY age DESC

would it list the the youngest to oldest people with the same last name - and then move onto the next group of lastnames, etc.? Would that be sorting the last names arbitrarily? If you wanted to sort the last names *reverse* alphabetically as well would you do this?:

SELECT lastname, age FROM people GROUP BY lastname ORDER BY lastname ASC, age DESC

Actually re-reading the GROUP BY descriptiong… maybe I DON’T understand GROUP BY… =sigh= anyone wanna help explain?

Best Known Blog

Friday, November 15th, 2002

According to Feeney’s “Name That Blog” Scriptygoddess is the best known blog. Woohoo! (or maybe we’re just the easiest to spot. Anything that starts off with stuff like this has to be from us: “So, you want to do this-that-and-the-other with PHP in your blog? No Problem! I was bored so I wrote a script to do it…”)

More Script Links

Thursday, November 14th, 2002

I’ll have to come up with a page that just lists ALL the links I’ve posted on this site… or maybe I’ll create a special page for the bookmarks category that displays not just the titles (as do the rest of the category pages) but the full text of the posts. (Just for bookmarks)… Have to think on that…

In any case - found this this morning:
weberdev - looks like there’s some scripts there, but does require (appears to be free?) registration.

And on that site, I clicked on some banner ads (yes, I actually CLICKED on a BANNER ad) and found these two sites:
Boxedart and
Template monster

I’m showing you those two links above because recently, I’ve been getting a lot of requests for “blog template” designs. Unfortunately, I really don’t have the time for that stuff. I’m overworked as it is ;-) However, aside from there being a number of people who DO do this work for hire, there are also a number of free template sites (feel free to leave links to those in the comments area if you have them handy), as well as the two above where you buy a template for $20 or so. If nothing else, even if you’re doing your own template design - it’s a good place to browse for ideas…

PHP resources

Wednesday, November 13th, 2002

Not sure if we’ve linked to these guys before… but I was looking for some info and these sites were particularly helpful this morning!

phpfreaks.com
SQL Course
SQL Course 2
Database Journal (which has sections specific for mySQL and PHP) (that’s where those SQL courses are from)

Flash tutorials and more!

Monday, November 11th, 2002

I’m working on some stuff in Flash MX - and found this site: kirupa.com that seems to have a ton of helpful info. If you have any other useful flash info sites - I’d love to see ‘em! (I’m flash-illiterate and can use all the help I can get!!)