Joomla Hosting

icm de datafeeds component


Webhosting Joomla € 4,99
Domeinnaam checken

Niet meer genoeg aan je shared host? Stap over op een VPS van up100!

Please Vote or Review this extensions


The Joomla!® name and logo are trademarked by Open Source Matters in the United States and other countries. The Joomla logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries. affiliatefeeds.nl is not affiliated with or endorsed by Open Source Matters or the Joomla! Project
Joomla templates by SG

Inloggen



Doneer

Gebruiker

automatic import

For automatic updating the feeds you will need to call the feedcron periodically. On unix style systems this is usually done using a cronjob. Most hosting providers allow to set up some cron.

There are two options calling the webpage using w g e t, curl or lynx. Or using the CLI version of php. The choice depends on the availability using the CLI version is highly recommend, this avoids  max_execution_time problems.

a typical webpage request looks like:

0 4 * * * w g e t http://www.example.com/administrator/components/com_datafeeds/cron/feedcron.php

(remove the spaces in w g e t)

a typical command line call:

0 4 * * * (cd  [path to the feedcron];php feedcron.php)

 

pseudo cron

Another option is to use a pseudo cron using your site visitors. This will work fine with small and/or a limited number of feeds.

 

 

The tmpl code below will periodically call the feedcron refreshing a single feed.

  1. put the code below in the script JOOMLA_ROOT/modules/mod_datamenu/tmpl/cron_custom.php
  2. you need a dummy feed as a semaphore/lock to avoid running multiple imports at once. Create a new feed, put in a name, click apply, ignore the messages but remember the number after cid[]= in the url, click save. don't publish.
  3. create a new mod_datamenu menu, select the cron_custom template. Put the module way down in your template, most templates have a module position 'footer' near the bottom.
  4. put the number from step 2 in the field 'default id' using a minus sign, thus if you got 19 put -19 in the box
  5. In the grid put in the minimal interval between importing a feed in minutes. do your math, when running 200 feeds with an update frequently of a day you will never get everything imported when using a 30 minute interval.
  6. publish the module.
  7. After a while you should see the 'last update' time of your dummy feed changing and feed should follow.
  8. Monitor the downloads for a while.

<?php // no direct access
#
# Copyright brambring.nl
# http://www.affiliatefeeds.nl
Dit e-mailadres is beschermd tegen spambots. U heeft Javascript nodig om het te kunnen zien.
#
defined'_JEXEC' ) or die( 'Restricted access' );
function 
Datacron_customMenu(&$dataitems,&$params) {
  
$image=false;
  
$id=$params->get('id');
  
$freq=$params->get('grid',60);
  
$query="update #__datafeeds set last_update=now() where feed_id = 
         $id and (`last_update` + interval $freq minute< now())"
;
  
$db =& JFactory::getDBO();
  
$db->setQuery$query);
  
$db->query();
  
$hits=$db->getAffectedRows();
  if ( 
$hits ) {
    
$query='SELECT feed FROM `#__datafeeds` WHERE (`last_update` + 
           interval `freq` second< now()) AND published>0 ORDER BY rand()' 

           ;
    
$db->setQuery$query0,1);
    
$feed=$db->loadResult ();
    
$hits=$db->getAffectedRows();
    if ( 
$hits ) {
      
$image=JURI::Base()."administrator/components/".
                          
"com_datafeeds/cron/feedcron.php?feed=".
                          
urlencode($feed);
    }
  }
  if ( 
$image) {
    echo 
'<img src="'.$image.'" alt="auto cron '.$feed.'" 
           style="width:1px;display:none"/>'
;
  }
}


 


 


 

Plaats reactie


Beveiligingscode
Vernieuwen