I’ve just discovered a problem with a template that I’m building and I’m wondering if this can be solved. I’ve done some digging and searching but so far haven’t had any luck.
I have a template group called “operatingdates” so my url I’m working from is:
http://mysite.com/operatingdates
I would like the index template to be populated with 2012 dates based on the segment_2 variable. Therefore if someone enters operatingdates/2012 they see operating dates for 2012, or if they wanted 2013 and so on. So my url would look like…
http://mysite.com/operatingdates/2012
or
http://mysite.com/operatingdates/2013
However, I have discovered that expression engine thinks “2012” is an entry_id number and is looking for 2012 as an entry_id in the database. I know this because if I change the number to a real entry_id I get a single result returned. ie. I have a date entered that has an id of ‘842’ if I enter mysite.com/operatingdates/842 I get a single entry returned.
Is there a way to tell exp eng. that “2012” is a variable and not an entry_id for an entry?
My entries tag currently looks like this:
{exp:channel:entries channel="operatingdates" start_on="{segment_2}-01-01 00:00” limit=“400”}
{segment_2} on the start_on parameter is the “2012”. I’ve already tried hard coding start_on as “2012-01-01 00:00” and my entries are returned for 2012 as expected. I just need the variable to come from segment_2 though.
Any advice would be much appreciated. Thanks in advance if anyone has thoughts.