For speed-kini.de we have two types of tables:
- Tables which show the current rankings overall, women, juniors, foil..
- Tables which show rankings of previous years (archive) for overall, women, juniors, foil…
The initial approach was having two different wpDataTables: one for the current year and one with the year as variable. This duplication should ring all your software engineer alarm bells!
Another possibility would have been to use the archive tables for the current rankings by just setting the variable to 2021, 2022 etc… this would mean work every year to edit the wordpress pages and manually increase the variable to the current year. So this is a bit nicer but still means regular maintenance work.
After some thought, I ended up with a neat approach how to use one table for both: current and archive.
For the current year you just leave the variable empty and for archive you specify the variable to your desired year.
The mechanism to default to the current year in case no year is specified consists of two parts:
#1 Setting the default value of %VAR1% to a very high number (> 5000 should be enough 😉 )
#2 Small SQL modifications to the places which use %VAR1%
[...]
WHERE
YEAR(date) = LEAST(year(curdate()), %VAR1%)
[...]
2 comments
Fantastic site Lots of helpful information here I am sending it to some friends ans additionally sharing in delicious And of course thanks for your effort
İstanbul su kaçak tamir servisi Sızıntıyı hızlıca bulup onardılar, tekrar teşekkürler! https://goodandbadpeople.com/ustaelektrikci