Direct URL in RSS
Posted July 8th, 2008 by dadone
Hello. I know you can get direct url for scoop by replacing $node_URL with $node->url in node-drigg.tpl.php. But why the rss isn't affected? How can i have direct link of scoop title in RSS?
PS: I use Views RSS, and i found this line: $link = url("node/$node->nid", NULL, NULL, 1); How can i make $link to get the url from drigg_node? Thx.
Repost clarifying
Hi,
Please repost your question posting FULL example URLs (as well as "what it is" and "what it should be" in terms of links, for example) to tell us exactly what you are actually talking about,.
This will save us a lot of time trying to work out what you are actually asking.
Merc.
Here it is
I've downloaded drigg-distr.tgz and installed. I added some scoops and i saw that when i click on the title, i go to the scoop page, and i wanted that the url redirect to original article. I've done that by replacing $node_URL with $node->url in node-drigg.tpl.php. Hope it's clear untill now. Next step was to make some custom rss feeds using views rss. From /feed/all/All i made something like rss/index.xml, but in the RSS, the link of the title points to the scoop page and i want to point to the original article. I don't know if this is a drigg thing or a drupal thing. Hope that now it's clear. Thx.
Amazingly...
Hi,
I looked at the code. I was myself amazed by the fact that... this can't be done very easily!
The only way to do this is by writing a tiny module, and then get it to implement hook_nodeapi, and then intercept the $op 'rss item', and then change
...
change...
Actually, you can't. Drupal works out the link for the feed in modules/node.module in the function:
function node_feed($nodes = 0, $channel = array())
So, your only way is to hack Drupal by changing:
$link = url("node/$node->nid", NULL, NULL, 1);
Into:
$link = $node->url;
This is the FIRST time in my life I advocate a hack in Drupal core. Here, you have no choice. So, that's what you'll have to do. Remember to document this change VERY carefully, because you'll lose it every time you upgrade Drupal (and hopefully you do that often).
I hope this helps.
Merc.
I did it!
Thx for your reply Merc. Actually i tried that already and didn;t worked that's why i posted here my problem, but i got it. Here is what i did:
Since i made custom rss feeds, i comented the line $link = url("node/$node->nid", NULL, NULL, 1); in views_rss.module and replaced the line $items .= format_rss_item($item->title, $link, $item_text, $extra); with this line: $items .= format_rss_item($item->title, $item->url, $item_text, $extra); That gives you the original url for the scoop. Hope this help other people with this problem.