[ic] Action Map - basics?

music at labyrinth.net.au music at labyrinth.net.au
Tue Aug 2 21:04:05 EDT 2005

I am adding a 'News' section to our Interchange store.

I have successfully added a new MySQL table 'News' and set this up in the UI 
so entries can be added.
'News' items are categorised by Categories similar to our Product 
For simplicity the 'News' table fields look something like:

code    category    newscontent
1    Hammers    New hammers released by Acme etc.
2    Nails    Acme releases line of titanium compound gang nails. etc
3    Nails    New tests show hand hammered nails five times stronger than 
gun nails etc

I have been able to display News items with a news.html page that uses 
[query] tag and SQL statements.

However, I thought that this might be a good opportunity to use ActionMap 

I think I have read every ActionMap post in the archives and docs however I 
am struggling getting this to work.
Before I go on this is my first ActionMap and I admit I do not fully 
understand the function.

I am hoping to be able to display news items using URLs as follows:




My ActionMap (added to catalog.cfg) looks like:

ActionMap  news  <<EOR
sub {
        my ($action, $category) = split ('/', shift);
        $CGI->{mv_todo} ='search';
        $CGI->{mv_nextpage} = 'resultsnews';
        $CGI->{mv_search_file} = 'News';
        $CGI->{mv_searchtype} = 'db';
        $CGI->{mv_coordinate} = 'yes';
        $CGI->{mv_return_fields} = 'code';
        $CGI->{mv_matchlimit} = '10';
        $CGI->{mv_sort_field} = 'category';
        $CGI->{mv_sort_option} = 'f,n';
        $CGI->{mv_search_field} = 'category';
        $CGI->{mv_searchspec} = "$category";
        $CGI->{banner_text} = "$category";
        return 1;

I am stuck trying to get anything to show up in the resultsnews page.

Can someone please advise what loop or list code I need to add to the 
resultsnews.html page to pull in the news items for selected categories and 
the correct tag to pull in data from the news table fields?


More information about the interchange-users mailing list