Interesting WordPress Smarty Functions

Here are some interesting Smarty equivalents of WordPress functions I hadn’t come across before:

  • {get_lastpostdate} or {get_lastpostmodified} – returns a timestamp, such as 2005-10-16 07:10:51 that contains the last post date. {get_lastcommentmodified} is identical, but for the last comment.
  • {human_time_diff from=n to=n} – similar to a script I wrote about, and implemented. Limited in that it only does days, not any larger unit. Advantage: done by the server, doesn’t ‘flash’ changing text via JavaScript, neater than my Smarty version.
  • {get_day_link} – much neater than the version I was using! Generates the URI as described. Also {get_page_link}, {get_year_link}, {get_month_link} and {get_feed_link}.
  • {globalvar var=varname value=value} – makes a value a global PHP variable. Very interesting…

Profiling AppleScript code

This looks promising. Shark is a tool that can be used to profile code. I haven’t done any serious profiling since some python script I was working on years ago on BeOS. Daniel Jalkut has a nice post, Shark Bites Script up on his blog, on how to use Shark to profile AppleScript code. Since I’ve been doing a bit of AppleScripting lately, and I have some code that is in serious need of optimisation, this might be worth a second look.