Hi, I would like to insert the news from
http://www.golem.de on my site. Golem provides a php script for this - now I am not a programmer and I am not sure if I am doing what I should do.
I created a block - inserted the php-script, choose php-script in the options below the text window when creating the block.
The code I inserted is this:
*************************
/*
// golemxml.php
//
// Version: 1.0.0
// Author: Soeren Fuhrmann -
sf@golem.de// Homepage:
http://www.golem.de//
// Based on: freshmeat.php3
// Version: 2.0.4
// Author: Kalle Kiviaho -
kivi@chl.chalmers.se// Lastmod: 2000-09-24
// Homepage:
http://swamp.chl.chalmers.se/backends/*/
// Customize as you like it
$link_prefix = "· ";
$link_postfix = "
\n";
$show_abstract = true;
$ab_link_prefix = "";
$ab_link_postfix = "
\n";
$ab_prefix = "";
$ab_postfix = "
\n";
$ab_more = "[mehr...]";
$ab_more_prefix = " \n";
$cache_file = "/www/tmp/golem.de.cache";
$cache_time = 0;
$max_items = 10;
$max_readsize = 10000;
$target = "_top";
// End of customizations
$backend = "http://www.golem.de/golem_backend.xml";
$items = 0;
$time = split(" ", microtime());
srand((double)microtime()*1000000);
$cache_time_rnd = 300 - rand(0, 600);
if ( (!(file_exists($cache_file))) || ((filectime($cache_file) + $cache_time - $time[1]) + $cache_time_rnd < 0) || (!(filesize($cache_file))) ) {
$fpread = fopen($backend, 'r');
if(!$fpread) {
// echo "$errstr ($errno)
\n";
// exit;
} else {
$fpwrite = fopen($cache_file, 'w');
if(!$fpwrite) {
// echo "$errstr ($errno)
\n";
// exit;
} else {
$string = fread($fpread, $max_readsize);
$pattern = "/
(.*?)<\/ARTIKEL>/is";
if (preg_match_all($pattern, $string, $match, PREG_SET_ORDER))
for($i= 0; $i< min(count($match), $max_items); $i++){
$artikel= $match[$i][1];
$pattern = "/(.*?)<\/HEADLINE>/i";
preg_match($pattern, $artikel, $lmatch);
$title= $lmatch[1];
$pattern = "/(.*?)<\/URL>/i";
preg_match($pattern, $artikel, $lmatch);
$link= $lmatch[1];
if($items== 0 && $show_abstract){
$pattern = "/(.*?)<\/ABSTRACT>/i";
preg_match($pattern, $artikel, $lmatch);
$abstract= $lmatch[1];
fputs($fpwrite, $ab_link_prefix."".$title."".$ab_link_postfix);
fputs($fpwrite, $ab_prefix.$abstract.$ab_more_prefix."".$ab_more."".$ab_postfix);
}else
fputs($fpwrite, $link_prefix."".$title."".$link_postfix);
$items++;
}
}
fclose($fpread);
}
fclose($fpwrite);
}
if (file_exists($cache_file)) {
include($cache_file);
}
?>
***************************
now: is there something I am doing wrong? I don't understand, as when I test the script (http://www3.golem.de/golemxml.php) it works - when I insert it in the block it doesnt ... or should I just insert the above link in an i-frame window?
Thank you for any hint.
Best, Sabine