Hi all,
I recently updated my Syndicate sidebar item with buttons for Google and Yahoo just for kicks and it brought up a question for me as I wanted to share it but couldn't figure out a pretty simple task.
The link for Google for example is http://fusion.google.com/add?feedurl=http%3A//www.teg.name/rss.xml but obviously it's not teg.name for anyone else. Is there an easy way or global I'm missing that lets me insert the root of Drupal's install (teg.name for me) so if I share the code for the buttons it is just copy and paste and not copy, paste, modify?
If anyone's wondering here is the code I used (change teg.name to your drupal install and search for the first line as that's unchanged in node.module:
$block['subject'] = t('Syndicate');
$block['content'] = ' '.'<a href="http://fusion.google.com/add?feedurl=http%3A//www.teg.name/rss.xml"><img src="http://www.google.com/favicon.ico" width="16" height="16" border="0" alt="Add to Google"></a>';
$block['content'] .= ' '.'<a href="http://add.my.yahoo.com/content?.intl=us&url=http%3A//www.teg.name/rss.xml"><img src="http://www.yahoo.com/favicon.ico" width="16" height="16" border="0" alt="Add to My Yahoo!"></a>';
$block['content'] .= ' '.theme('feed_icon', url('rss.xml'));
Thanks,
Andrew
Comments
The variable for the base
The variable for the base URL of a site, is $base_url. So you can use that in the appropriate place, something like
$feed = 'http://fusion.google.com/add?feedurl=http%3A//' . $base_url . '/rss.xml';If it has not been declared yet in the module, you need place a line like:
global $base_url;______
Skejo.com, Where Your Knowledge is Rewarded.
Thanks (Updated Code)
Thanks, declaring base_url works great. The updated code looks great and works well and gives users the option to add it to Google or Yahoo :)
Try $base_url
You could try $base_url. If that doesn't work for you, try somthing like this:
- L0rne
- L0rne