Hello!
I have setup RSS Imports with many feeds. Now when I do an import, the last setup RSS import imports the last and the home page is filled with items of that particular feed.
Now am wondering if there is a way to randomize the imported items from all feeds??
Thanks
Envieme
![]() |
| | LinkBack | Thread Tools | Display Modes |
| |||
| Randomize RSS Import |
| |||
| Quote:
|
| ||||
|
The easiest way to do this is by setting up a cron job. Lower the number of stories it imports from each feed (say to 1) and then set the cron job to run every x period. This will pull one story from each feed and then start the whole process over again the next time the feed pulls. This works well, the one problem I have is that I want it to run every five minutes or so, but RSS Importer currently allows a minimum of 1 hour between pulls...I'm still looking for the code to change for this. David.
__________________ - Informed Networker - Social News for Network Engineers and System Administrators. |
| The Following User Says Thank You to davemackey For This Useful Post: | ||
| ||||
| Quote:
modules/rss_import/templates/import_fields_center.tpl look for $y = (time() - ($feed->feed_freq_hours * 3600)); Hope that helps.
__________________ Visit PliggPro the official Pligg Mods & Template Shop! |
| The Following 2 Users Say Thank You to chuckroast For This Useful Post: | ||
| |||
|
Thank you for the nice tip!
|
| |||
| Quote:
But isn't there a way to make the import random? Like in import.php I have been trying to do but can't figure out how! |
| ||||
|
Thanks chuckroast, I'll give that a try.
__________________ - Informed Networker - Social News for Network Engineers and System Administrators. |
| ||||
|
Okay, figure I'd post what I've found out. The actual line of code I need is this one in import_fields_center.tpl: PHP Code: time() = a php function equal to the number of seconds since 1/1/1970. $feed->feed_freq_hours = how frequently the feed should be grabbed. *3600 = creates a value in seconds. Thus for example, the first part with constants might look like (1198368000 - (1 * 3600)) Which in turn reduces down to: (1198364400) Okay, now the second half: strtotime($feed->feed_last_check) = Grabs the value and changes it into a time that the feed was last checked. && ($GET['override'}=='' = Says that this only occurs if there is no override of the time functionality. We don't need to pay attention to most of it, just boil it down to: 1198364400 > last_check. Let's say just for argument that the check was ten minutes before the current time: 1198364400 > 1198363800 Its not true. This is because we subtracted an hour from now to find our next check time but only ten minutes from the last check. So, let's say I want to make it check every five minutes, I would do this: (time() - ($feed->feed_freq_hours * 300)) 300 = 60 * 5. Thus we are only subtracting five minutes from the current time, allowing it to run every five minutes. Thats all for now folks. Let me know if you have questions! David.
__________________ - Informed Networker - Social News for Network Engineers and System Administrators. |
| ||||
|
Well, that doesn't seem to be working. Can anyone see an issue in the code I'm missing? David.
__________________ - Informed Networker - Social News for Network Engineers and System Administrators. |
| |||
|
You are actually multiplying 300*5 in your code giving you 1500 seconds or 25 minutes. I'd say the best way to do this so it is still configurable from the admin control panel is by changing the 3600 constant to 60 seconds (1 minute) PHP Code: I haven't tested this, but I'm pretty sure it should work.
__________________ Pligg Site: www.NewsHeat.com Slogan: Where The Campaign Trails Meet Pligg Version: beta v9.9 (updated since 9.1) Template: Modified "coolwater" Other Sites: Cheesy Movie Night, Tranquil Aggression |
| The Following User Says Thank You to NewsHeatDotCom For This Useful Post: | ||
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Capture video thumbnails from rss import and display them on published/upcoming site | tand | Modification Tutorials | 7 | 05-16-2008 03:16 AM |
| RSS import not working | rssblog | Modification Tutorials | 0 | 03-05-2008 04:19 AM |
| RSS Importer: How can I import individual feeds, not all I have set up? | slobizman | General Help | 1 | 01-03-2008 03:36 AM |
| Rss import = blank | argh2xxx | Bug Report | 5 | 05-17-2007 11:26 PM |
| RSS import feature | srrpenna | General Help | 4 | 12-28-2006 06:39 AM |





Linear Mode

