Change page content order based on the month?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Publisher Bucks
    Confirmed User
    • Oct 2018
    • 1332

    #1

    Tech Change page content order based on the month?

    So, I have a block of text (list of months with description below) on a page that I'd like to update dynamically based on the month of the year for example, presently it looks like this:

    January | February | March
    April | May | June
    July | August | September
    October | November | December

    What I'd like to happen, is for this month (September), the page to look like this, and every month the current month cycles to the first position:

    September | October | November
    December | January | February
    March | April | May
    June | July | August

    What is the best way to achieve this please?

    Presently the page itself is hard-coded, no database involved, but if its needs to go into a DB that isnt a problem, I'm just not sure what the best way to achieve this would be, i'm guessing I will end up having to use something to do with the php date function ("F")?

    Any advice or suggestions greatly appreciated.

    Thanks!
    Extreme Link List - v1.0
  • baodb
    Confirmed User
    • Jan 2021
    • 103

    #2
    It depends a lot on how your page works. Is this dynamically built with PHP, Static rendered, spa?

    Comment

    • redwhiteandblue
      Bollocks
      • Jun 2007
      • 2793

      #3
      You get the current month of the year as a number with date("m").
      Interserver unmanaged AMD Ryzen servers from $73.00

      Comment

      • sarettah
        see you later, I'm gone
        • Oct 2002
        • 14318

        #4
        Originally posted by redwhiteandblue
        You get the current month of the year as a number with date("m").
        Once you have the current month you can just loop through to make your list in the order you need it in.

        .
        All cookies cleared!

        Comment

        • Publisher Bucks
          Confirmed User
          • Oct 2018
          • 1332

          #5
          Awesome, thank you
          Extreme Link List - v1.0

          Comment

          Working...