debug help requested - Programmers Heaven

Howdy, Stranger!

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


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

debug help requested

blesbokblesbok Posts: 2Member
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


Sign In or Register to comment.