search by 1 day, 3 days, week
2 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: February 10, 2014 (RSS)
By reddirt - February 9, 2014
i have the basic auto template, i need to add to the search by 1 day old, 3 day, 1 week. The more i read the more confusing it becomes. can someone point me, to where to start to learn how to add to the search.
thank you.
By Dave - February 10, 2014
Hi reddirt,
You can find some docs on creating search forms here: http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html
And some sample code here: http://www.interactivetools.com/forum/forum-posts.php?postNum=2232534#post2232534
I think you're going to want something like this:
<a href="?createdDate_min=<?php echo mysql_datetime(strtotime("-1 day")); ?>">1 day old</a>
<a href="?createdDate_min=<?php echo mysql_datetime(strtotime("-3 days")); ?>">3 days old</a>
<a href="?createdDate_min=<?php echo mysql_datetime(strtotime("-1 week")); ?>">1 week old</a>
just replace "createdDate" with the name of your listings date field (if it's a different name). It's a little tricky because we need to use a little bit of PHP code to generate the date as of (1 day, 3 days, 1 week) ago that is the oldest date you want to show.
Hope that helps! Let me know how it goes.
interactivetools.com