[SOLVED ]Additional functionality to News & Search

A place to make for-pay "CMS made simple" job offerings
Post Reply
applejack
Power Poster
Power Poster
Posts: 1015
Joined: Fri Mar 30, 2007 2:28 am
Location: London

[SOLVED ]Additional functionality to News & Search

Post 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.
Last edited by applejack on Thu Oct 01, 2009 4:22 pm, edited 1 time in total.

Website Design & Production
http://www.applejack.co.uk
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Additional functionality to News & Search

Post 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...
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
applejack
Power Poster
Power Poster
Posts: 1015
Joined: Fri Mar 30, 2007 2:28 am
Location: London

Re: Additional functionality to News & Search

Post by applejack »

Hi Robert

Thanks as always, your a star.

Website Design & Production
http://www.applejack.co.uk
Loopy
Forum Members
Forum Members
Posts: 38
Joined: Sat Jun 10, 2006 5:34 pm

Re: [SOLVED ]Additional functionality to News & Search

Post 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.  ???
applejack
Power Poster
Power Poster
Posts: 1015
Joined: Fri Mar 30, 2007 2:28 am
Location: London

Re: [SOLVED ]Additional functionality to News & Search

Post 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.

Website Design & Production
http://www.applejack.co.uk
applejack
Power Poster
Power Poster
Posts: 1015
Joined: Fri Mar 30, 2007 2:28 am
Location: London

Re: [SOLVED ]Additional functionality to News & Search

Post 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.

Website Design & Production
http://www.applejack.co.uk
Evert B.
Power Poster
Power Poster
Posts: 414
Joined: Fri Oct 20, 2006 12:07 pm

Re: Additional functionality to News & Search

Post 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?
applejack
Power Poster
Power Poster
Posts: 1015
Joined: Fri Mar 30, 2007 2:28 am
Location: London

Re: [SOLVED ]Additional functionality to News & Search

Post 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.
Reitz
New Member
New Member
Posts: 2
Joined: Sun Jun 17, 2012 4:40 pm

Re: [SOLVED ]Additional functionality to News & Search

Post 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.
gocreative
Power Poster
Power Poster
Posts: 265
Joined: Mon Mar 14, 2011 1:16 am
Location: Brisbane, Australia

Re: [SOLVED ]Additional functionality to News & Search

Post 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.
psy
Power Poster
Power Poster
Posts: 463
Joined: Sat Jan 22, 2005 11:19 am

Re: [SOLVED ]Additional functionality to News & Search

Post 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
Post Reply

Return to “Help Wanted (commercial)”