please help me debug this script:
[code]*/
function goodreads_block($op='list' , $delta=0, $edit=array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('Goodreads Bookshelf');
return $blocks;
case 'view':
$url = '
http://www.goodreads.com/review/list_rss/' .'398385'
.'?shelf='
.'history-of-philosophy';
$blocks['subject'] = t('On the Bookshelf');
$blocks['content'] = _goodreads_fetch_bookshelf($url);
return $blocks;
}
}
/**
*
* Retrieve information from the Goodreads bookshelf XML API.
*
* This makes an HTTP connection to the given URL, and
* retrieves XML data, which it then attempts to format
* for display.
*
*
@param $url
* URL to the goodreads bookshelf.
*
@return * String containing the bookshelf.
*/
function _goodreads_fetch_bookshelf($url, $num_items=3) {
$http_result = drupal_http_request($url);
if ($http_result->code == 200) {
$doc = simplexml_load_string($http_result->data);
if ($doc === false) {
$msg = "Error parsing bookshelf XML for %url: %msg.";
$vars = array('%url'=>$url, '%msg'=>$e->getMessage());
watchdog('goodreads', '$msg, $vars, WATCHDOG_WARNING);
return t("Getting the bookshelf resulted in an error.");
return _goodreads_block_content($doc, $num_items);
[b] // Otherwise we don't have any data[/b]
}
else {
$msg = 'No content from %url.';
$vars = array('%url' => $url);
watchdog('goodreads', $msg, $vars, WATCHDOG_WARNING);
return t("The bookshelf is not accessible.");
}
}[/code]
i get the error: PHP Parse error: syntax error, unexpected T_STRING in the line i've marked bold
Comments
: watchdog('goodreads', '$msg, $vars, WATCHDOG_WARNING);
:
should rather be:
[code]watchdog('goodreads', $msg, $vars, WATCHDOG_WARNING);[/code]