I had some old RSS java code. I've translated it and it seems to work.
- gunzip and untar this post's attachment.
- copy the news dir under your moodle home.
- make the dir and the news.xml file inside writable for all.
- login into your moodle server as admin.
- invoke manually http://your_server/moodle/news/news.php
- open your RSS client.
- subscribe to http://your_server/moodle/news/news.xml
Hope it helps,ciao
PS: You can personalize the RSS image (changing news.gif), the number of news to publish (editing news.php->$max_num_articles) and the destination file to save the rss (editing news.php->$destination_file).
Thanks for your module - I have got it up and running and am translating it using an rss parser for the home page of the site. Couple of questions:
1. How do you get rid of the image altogether? I do not have much room for the display of my feed so I need to remove all ancillary parts.
2. Do I need to set up a chron job to get the php to automatically update the xml page?
I'd like to integrate this properly eventually but for now I've made a feed for moodle.org:
Michelle, you can make a cron job the same way you made one for Moodle cron.php (you will just have to make sure to remove the line at the top that requires the admin and find another way to protect it), or just run Eloy's script manually whenever you change the site news.
Just thinking ahead...[grin]
This is great. Thanks for implementing it, and thanks to Eloy for providing the script. RSS is a subject near and dear to my heart, since one of my side projects, HyperDig, is a web-based RSS aggregator. I'm looking forward to this getting integrated into the code base.
From a mangerial standpoint, it might be useful to have RSS feeds for the "Latest news" and "Recent activity" boxes, too. It'd be great to be able to monitor what was going on in multiple courses without having to switch into each course.
changing slightly the news.php file you can execute the script for each course in your server:
- Copy your news.php to news_per_course.php
- Edit news_per_course.php
- Change line 10 from:
$destination_file = $CFG->dirroot."/news/news.xml";
$destination_file = $CFG->dirroot."/news/news".$id.".xml";
- Change line 56 from:
$newsforum = forum_get_course_forum($site->id, "news");
$newsforum = forum_get_course_forum($id, "news");
- Invoke news/news_per_course.php?id=ZZ (where ZZ is the id of your desired course)
- This will generate a newsZZ.xml file with the news from your course.
It'll need some refinements but I think It'll work!
Hope it helps....
I ask humbly, please do a step by step "HowTo" for RSS feeds for
- Moodle news
- Moodle Categories
- Moddle Course (Posting of new Activies / Resources / etc...
- Moodle Events
"New HowTos" forum located at,
Also a doc which might be helpful,
Final HowTo Format
As Loren indicated above it would be nice to be able to download Moodle news into a "HandHeld". This has been discussed on some other threads,
New Module: Shelf
Pocket PC "Handhelds/Palm OS" Themes
There appears to be two main HandHeld programs,
Avantgo - which I think is now pay for those who want to post links to their sites
Plucker - which is open source.
Some sites provide direct links to Avantgo and Plucker. A coder did this for phpNuke sites.
I am not a programmer (yet ) but I am putting the information out there in the hopes that one of the programmers will take this task on. I also think it will be a great promotion feature for Moodle and Moodle based sites.
Thanks for all your work.
Thanks! I'm wary of doing any code changes right now, 'cause we're in the middle of a semester. I'm going to upgrade our site to 1.2.1 after the session ends in May. I'll give your XML stuff a try then.
This is really appreciated!
Ok, after reading Martin's RSS reference, I see the educational value...
phough..I have now my local /news/news.xml in place
If I now want a rss-box on my frontpage, what should I type in this box:
print_side_block_start( "<center><b>Moodle<sup>RSS</b></sup></center>", 210,"");
I was wondering if this could help: http://www.phpclasses.org/browse/package/80.html
thanks in advance.
as RSS feeds aren't part of Moodle's official release, there isn't any frontend to configure or execute it (manually or automatically).
The easiest proc. to do this is:
Invoke http://yourserver/yourmoodle/news/news.php manually from the browser to update your news. You must be logged as admin before!
Too, you can use some type of cron system, but it involves modifying news.php and it's more complicated!
you always need a RSS client to read the news. It's how RSS feeds work...
Other different thing is that, under Moodle, it's possible to build an RSS client (using the Blocks System, perhaps) to display such info, and potentially, any RSS feed in the world...
Some days ago, Jordi Adella submitted a new bug about this.
The tool I use for that is pretty cool and complete, regarding use and management of RSS / XML / etc. syndication feeds. It is called MyHeadlines by Mike Jagar, and more can be found at http://www.jmagar.com/.