Adding a Watch Wearing Log to This Site

20 May 2024 | ~2 minute read

Everyone knows I'm a watch geek, but I've now taken it one step further and added a watch wearing log to this site.

Ok, so what am I talking about here? Well, you know how I'm a watch nerd, and have my collection listed on this site? Well, I decided to build upon this by adding a random watch picker, and watch wearing log too.

Pretty simple, right? But building this whole thing proved to be far more difficult than I first thought. Here's the steps involved in making this work:

  1. Take my watch collection and exclude and watches in the "Sold" section
  2. Of those watches, pick a random one
  3. Display that random watch on the random-watch page
  4. Check if the person visiting the pages is logged in (I.E. me)
    • If they are, display a button that allows me to "wear this watch"
    • If they're not, hide the "wear this watch" button
  5. Include a button to "try again" if the random watch isn't appropriate (for example if I'm working in the garden that day and it chooses a dress watch)
  6. When I click the "wear this watch" button, write the watch name and the date I wore the watch to a text file
  7. Parse that text file and display the date and watch name under the log section
  8. Make sure the watch name links back to the appropriate watch within my collection

See, there's lots going on here, right? But I've managed to come up with a way to get it all working as it should. Thank goodness for PHP!

All in all the snippet of code that does this is a little over 100 lines. This is probably small fry for many of you developers out there, but I'm not a dev, so I'm very proud of myself for working this out. Yay me!

Check out my watch log

← The one before
Tower of Silence

Up next →
It's All Very Narcissistic, Right?

Get in touch!

Receiving emails from my readers is my favourite thing, so if you have something to say, feel free to drop me an email or sign my guestbook.

Want more content?

Say no more, dear reader. Click the button below to be taken to a random post:

Read a random post...

Want to be informed when I post new articles? Simply enter your email address below and you will get an email whenever new posts are published.

Alternatively, you can subscribe via RSS instead.

Enjoyed this post?

I put a lot of work into maintaining this site and I really enjoy interacting with my readers.

My fuel of choice is coffee, so if you did enjoy this post, or found it in any way useful, I'd appreciate more fuel to keep me going. ❤️

Buy me a coffee