What I’m trying to do
I have this templater code which will copy in text based on which day of the week it is. However, it doesn’t output anything… any ideas?
<%*
if (tp.date.weekday("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD ddd") == tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD ddd") ) {
tp.file.include("[[Daily Plans#Defaults#Monday]]") }
else {
if (tp.date.weekday("YYYY-MM-DD", 2, tp.file.title, "YYYY-MM-DD ddd") == tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD ddd") ) {
tp.file.include("[[Daily Plans#Defaults#Tuesday]]") }
else {
if (tp.date.weekday("YYYY-MM-DD", 3, tp.file.title, "YYYY-MM-DD ddd") == tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD ddd") ) {
tp.file.include("[[Daily Plans#Defaults#Wednesday]]") }
else {
if (tp.date.weekday("YYYY-MM-DD", 4, tp.file.title, "YYYY-MM-DD ddd") == tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD ddd") ) {
tp.file.include("[[Daily Plans#Defaults#Thursday]]") }
else {
if (tp.date.weekday("YYYY-MM-DD", 5, tp.file.title, "YYYY-MM-DD ddd") == tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD ddd") ) {
tp.file.include("[[Daily Plans#Defaults#Friday]]") }
else {
if (tp.date.weekday("YYYY-MM-DD", 6, tp.file.title, "YYYY-MM-DD ddd") == tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD ddd") ) {
tp.file.include("[[Daily Plans#Defaults#Saturday]]") }
else {
if (tp.date.weekday("YYYY-MM-DD", 7, tp.file.title, "YYYY-MM-DD ddd") == tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD ddd") ) {
tp.file.include("[[Daily Plans#Defaults#Sunday]]") }
} } } } } } %>
Also, is there a better way to do a sequence of if-else statements?