replace default drupal rss feed for mm pages?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

replace default drupal rss feed for mm pages?

grahamtk
This post has NOT been accepted by the mailing list yet.
Hi!
I have tried to search through the monster_menus module code to find out how
my/mmpage/path/with/feed might be implemented, I thought maybe it was a menu router path like mm/%mmtid/feed or something that could be overridden.  

What I am seeking to accomplish is using my new and improved feed from views rss in place of the standard rss.xml one.  it is now a views page with this url: <a href="https://www.nmbu.no/rssfeed/%mmtid/rss.xml">https://www.nmbu.no/rssfeed/%mmtid/rss.xml
how could I accomplish that given/mmpage/path/feed would resolve to this or a similar views rss feed url?

Why rss views?
( Views rss makes it possible to define what fields are output and add extra fields etc. which is needed in my case, as not many rss readers do not render rss 2.0 feeds correctly (used by drupal 7 built in rss rendering) where html can be included in the description rss field.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: replace default drupal rss feed for mm pages?

McBride, Ian S.
The feeds are created in _mm_render_pages() in misc.inc. There are two important places (my line numbers might be slightly off here due to our local mods, but they should be close enough). On line 1568, if "feed" is in the page arguments list, the nodes on the page are loaded into an array and passed into the built-in Drupal function node_feed(). You could use hook_nodeapi() to alter how they are rendered by that.

A slightly more hacky, but probably easier approach for you would be to change line 1595:

'href' => !empty($rss_link) ? $rss_link : url("mm/$this_mmtid/feed", array('absolute' => TRUE))));

And put the URL of your view's menu hook in place of mm/$this_mmtid/feed.
________________________________________
From: grahamtk <[hidden email]>
Sent: Tuesday, February 17, 2015 4:57 PM
To: Monster Menus Development
Subject: replace default drupal rss feed for mm pages?

Hi!
I have tried to search through the monster_menus module code to find out how
my/mmpage/path/with/feed might be implemented, I thought maybe it was a menu
router path like mm/%mmtid/feed or something that could be overridden.

What I am seeking to accomplish is using my new and improved feed from views
rss in place of the standard rss.xml one.  it is now a views page with this
url: <a href="https://www.nmbu.no/rssfeed/%mmtid/rss.xml">https://www.nmbu.no/rssfeed/%mmtid/rss.xml
how could I accomplish that given/mmpage/path/feed would resolve to this or
a similar views rss feed url?

Why rss views?
( Views rss makes it possible to define what fields are output and add extra
fields etc. which is needed in my case, as not many rss readers do not
render rss 2.0 feeds correctly (used by drupal 7 built in rss rendering)
where html can be included in the description rss field.




--
View this message in context: http://monster-menus.2910260.n2.nabble.com/replace-default-drupal-rss-feed-for-mm-pages-tp7573058.html
Sent from the Monster Menus mailing list archive at Nabble.com.

---
You are currently subscribed to monster_menus as: [hidden email].
To unsubscribe click here: http://lists.middlebury.edu/u?id=685439.7e7cbccf9bb225cf8471bffe1cb67503&n=T&l=monster_menus&o=712078
or send a blank email to [hidden email]

---
You are currently subscribed to monster_menus as: [hidden email].
To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=712097
or send a blank email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: replace default drupal rss feed for mm pages?

Dan Wilga-2
In reply to this post by grahamtk
On 2/18/15 8:53 AM, McBride, Ian S. wrote:
The feeds are created in _mm_render_pages() in misc.inc. There are two important places (my line numbers might be slightly off here due to our local mods, but they should be close enough). On line 1568, if "feed" is in the page arguments list, the nodes on the page are loaded into an array and passed into the built-in Drupal function node_feed(). You could use hook_nodeapi() to alter how they are rendered by that.

A slightly more hacky, but probably easier approach for you would be to change line 1595:

'href' => !empty($rss_link) ? $rss_link : url("mm/$this_mmtid/feed", array('absolute' => TRUE))));

And put the URL of your view's menu hook in place of mm/$this_mmtid/feed.
Or you could use hook_url_outbound_alter () to change URLs ending in /feed so that they use something handled by your module.

---

You are currently subscribed to monster_menus as: [hidden email].

To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=712098

(It may be necessary to cut and paste the above URL if the line is broken)

or send a blank email to [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: replace default drupal rss feed for mm pages?

grahamtk
hook_url_outbound_alter worked perfectly
to replace core feed motor and use a views rss in place of it.

I made a view with https://www.drupal.org/project/views_rss
and set its url to be rsfeed/%/rss.xml and the contextual parameter to be a
mmtid given to a mm nodes on page contextual filter. configured which fields
should show up, and voila.

test here: http://www.nmbu.no/aktuelt/feed
it is served as http://www.nmbu.no/rssfeed/7852/rss.xml

Thanks for advice that helped solve this!
                                                                                               
/**
 * Implement hook_url_outbound_alter                                                            
 *  
 * The purpose is to overwrite drupals rss feed system
 * for MM-pages that has feed enabled.
 *
 */                                                                                            
function umb_article_url_inbound_alter(&$path, $original_path,
$path_language) {
  if (preg_match('|^mm/(.*)/feed|', $path, $matches)) {
    global $user;
    $path = 'rssfeed/' . $matches[1] . '/rss.xml';
    drupal_goto($path);
  }
}                                                                                            



--
View this message in context: http://monster-menus.2910260.n2.nabble.com/replace-default-drupal-rss-feed-for-mm-pages-tp7573058p7573062.html
Sent from the Monster Menus mailing list archive at Nabble.com.

---
You are currently subscribed to monster_menus as: [hidden email].
To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=712654
or send a blank email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: replace default drupal rss feed for mm pages?

grahamtk
This post has NOT been accepted by the mailing list yet.
In reply to this post by Dan Wilga-2
hook_url_outbound_alter worked perfectly
to replace core feed motor and use a views rss in place of it.

I made a view with https://www.drupal.org/project/views_rss
and set its url to be rsfeed/%/rss.xml and the contextual parameter to be a mmtid given to a mm nodes on page contextual filter. configured which fields should show up, and voila.

test here: http://www.nmbu.no/aktuelt/feed
it is served as http://www.nmbu.no/rssfeed/7852/rss.xml

Thanks for advice that helped solve this!
                                                                                               
/**
 * Implement hook_url_outbound_alter                                                            
 *  
 * The purpose is to overwrite drupals rss feed system
 * for MM-pages that has feed enabled.
 *
 */                                                                                            
function umb_article_url_inbound_alter(&$path, $original_path, $path_language) {
  if (preg_match('|^mm/(.*)/feed|', $path, $matches)) {
    global $user;
    $path = 'rssfeed/' . $matches[1] . '/rss.xml';
    drupal_goto($path);
  }
}                                                                                            
Loading...