Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Blog Module /

Discuss the Blog Module.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Search in blog module by date of post


Go to End


935 Views

Avatar
soft dsgn

Community Member, 1 Post

2 December 2011 at 8:50pm

Hey all,

I'm wondering if i can use the search function I have setup for my blog to search by the date of the post?

Currently it is set up to search the text of the blog (and i have a tag filter set up for custom tags) and i'd ilke to be able to search by month and year also. Here's the code presently in page.php

-------------------------------------------------------------------------

function SearchForm(){
$searchText = isset($_REQUEST['Search']) ? $_REQUEST['Search'] : 'Search / ';
$fields = new FieldSet(
new TextField("Search", "", $searchText)
);
$actions = new FieldSet(
new FormAction('results', ' ')
);
$homePage = DataObject::get_one('HomePage');
$controller = new Page_Controller($homePage);
return new Form($controller, "SearchForm", $fields, $actions);

--------------------------------------------------------------------------

Would love some help to work this out.
Cheers..