Page 1 of 1

[SOLVED ]Additional functionality to News & Search

Posted: Wed Sep 30, 2009 2:05 pm
by applejack
Hi I need some additional functionality to the news and search.

For News I need a most read articles option so on the front end I can have a content block and just put in a tag to show say the most 5 popular news articles. The system would have to be able to set the date range in which to search for this i.e. 30 days. Ideally this would not have to effect the core news module or if it does in a minimal way which is easy to incorporate into updates to CMSMS.

For search I need to ability to have a drop down menu pre-populated with all categories (probably just top level categories) and for the the keyword search to only search the chosen category.

Re: Additional functionality to News & Search

Posted: Thu Oct 01, 2009 3:20 pm
by calguy1000
The HitCounter could be expanded to have the ability to return results within a specified amount of days (right now it's a very simple module)...  so something like
{HitCounter action=getmostvisited ndays=30 key1=news assign='theidlist'}
could return a list of news article id's.... which you could then use a foreach loop to call the news on.
like:
{foreach from=theidlist item=oneid}
  {News action=detail articleid=$oneid detailtemplate=short_details}
{/foreach}

As far as search goes....  that's a two step process:

the action=browsecat can generate a list of categories (may have to add a slight tweak this to only show top level categories).... after that it's trivial to put the results in a dropdown with some javascript/jquery to grab the dropdown value and add it to the form.

Currently the search module indexes ALL news articles, and then calls the News module to gather the information (title and link) for display.  so what would be required is a way to hide the results based on wether the category of the news article was in the selected category, or one of its children.  We would need to pass the desired category, and possibly an 'allowchildren' flag to the news module for when it's returning results.This would require a simple modification to the News module to allow accepting 'passthru' parameters, and how to handle them.  i.e you would call Search like:

{Search passthru_News_category='blah' passthru_News_allowchildren='1'}

The passthru_News_category becomes a hidden input field in the form, jquery/javascript can update that field based on the selected value in the dropdown.

These are all very simple modifications, which are then re-usable by any website...

Re: Additional functionality to News & Search

Posted: Thu Oct 01, 2009 4:22 pm
by applejack
Hi Robert

Thanks as always, your a star.

Re: [SOLVED ]Additional functionality to News & Search

Posted: Fri Oct 02, 2009 11:39 am
by Loopy
Hi. I'm looking for the dropdown search function in search module as well but I know very little php/jquery. Is there somewhere I can get a fuller explanation? Thanks.  ???

Re: [SOLVED ]Additional functionality to News & Search

Posted: Thu Oct 15, 2009 2:39 pm
by applejack
Hi Loopy

No as I haven't needed to do it yet. You need to use Javascript to do it though. I am not 100% sure about how to do this so I would post another message to the Forum as I am sure it has been done many time before. I would really appreciate it if you could let me know if you find a solution.

Re: [SOLVED ]Additional functionality to News & Search

Posted: Fri Nov 06, 2009 5:21 pm
by applejack
Hi Loopy

Did you manage to sort this out? If not then I will be doing a site shortly which needs this functionality with the news category select option. I should be able to do most of this myself though may need Calguy's or someone else's help with mod of the News module if it is needed.

Re: Additional functionality to News & Search

Posted: Wed Jan 11, 2012 1:38 pm
by Evert B.
calguy1000 wrote:the action=browsecat can generate a list of categories (may have to add a slight tweak this to only show top level categories).... after that it's trivial to put the results in a dropdown with some javascript/jquery to grab the dropdown value and add it to the form.

Currently the search module indexes ALL news articles, and then calls the News module to gather the information (title and link) for display. so what would be required is a way to hide the results based on wether the category of the news article was in the selected category, or one of its children. We would need to pass the desired category, and possibly an 'allowchildren' flag to the news module for when it's returning results.This would require a simple modification to the News module to allow accepting 'passthru' parameters, and how to handle them. i.e you would call Search like:

{Search passthru_News_category='blah' passthru_News_allowchildren='1'}

The passthru_News_category becomes a hidden input field in the form, jquery/javascript can update that field based on the selected value in the dropdown.
I think I get step two, but how to use step one?
I too want to be able to search only a certain news catagory... anyone solved this yet?

Re: [SOLVED ]Additional functionality to News & Search

Posted: Wed Jan 11, 2012 2:03 pm
by applejack
The passthru search results function isn't written as far as I know. Are you wanting this for the News module or CGBlog. I have a specially written function for the CGBlogs module and there are also bugs in the Search module which need correcting before you can get this to work.

For an example please see http://www.commercialriskeurope.com

If you are interested in commercial support for this then pm me.

Re: [SOLVED ]Additional functionality to News & Search

Posted: Sun Jun 17, 2012 4:44 pm
by Reitz
Hi,
I didn`t tried yet but I guess this can be done using only css3 (if you're looking for a mouse over event). I also need to make a dropdown for categories menu, I`ll check it out and reply here later.

Re: [SOLVED ]Additional functionality to News & Search

Posted: Sun Jul 08, 2012 4:48 am
by gocreative
It'd be great if the Search module was enhanced to allow some of this stuff to be automated. For example:

* Which module(s) it will search by default
* Whether users can choose which modules to search (overriding the default options)
* The name to display for each module in the search results
* Whether an Advanced Search link/page is offered
* Any particular URLs/pages to ignore

Each module could then plug into this further by allowing module-specific options. In the case of the News module, within the Search module you'd have a section 'News module options' which provides further options such as 'Category search available', and so on.

Re: [SOLVED ]Additional functionality to News & Search

Posted: Fri Jul 13, 2012 10:35 am
by psy
Until the passthru param is implemented, you may like to play with my template based solution.


http://forum.cmsmadesimple.org/viewtopi ... =4&t=61947