debug help requested

please help me debug this script:

function goodreads_block($op='list' , $delta=0, $edit=array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('Goodreads Bookshelf');
return $blocks;
case 'view':
$url = ''
$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.");

i get the error: PHP Parse error: syntax error, unexpected T_STRING in the line i've marked bold


  • : watchdog('goodreads', '$msg, $vars, WATCHDOG_WARNING);

    should rather be:

    [code]watchdog('goodreads', $msg, $vars, WATCHDOG_WARNING);[/code]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion