GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Tech Change page content order based on the month? (https://gfy.com/showthread.php?t=1357177)

Publisher Bucks 08-20-2022 12:23 AM

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!

baodb 08-20-2022 08:55 AM

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

redwhiteandblue 08-20-2022 10:13 AM

You get the current month of the year as a number with date("m").

sarettah 08-20-2022 11:20 AM

Quote:

Originally Posted by redwhiteandblue (Post 23035144)
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.

.

Publisher Bucks 08-20-2022 05:41 PM

Awesome, thank you :)


All times are GMT -7. The time now is 03:56 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc