Blesbok Posted November 17, 2008 Share Posted November 17, 2008 */ 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); // Otherwise we don't have any data } 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: // Otherwise we don't have any data Link to comment https://forums.phpfreaks.com/topic/133047-solved-please-help-me-debug-this-script/ Share on other sites More sharing options...
vbnullchar Posted November 17, 2008 Share Posted November 17, 2008 watchdog('goodreads', '$msg, $vars, WATCHDOG_WARNING); Link to comment https://forums.phpfreaks.com/topic/133047-solved-please-help-me-debug-this-script/#findComment-691935 Share on other sites More sharing options...
vbnullchar Posted November 17, 2008 Share Posted November 17, 2008 corrected <?php 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); // Otherwise we don't have any data } } else { $msg = 'No content from %url.'; $vars = array('%url' => $url); watchdog('goodreads', $msg, $vars, WATCHDOG_WARNING); return t("The bookshelf is not accessible."); } } ?> Link to comment https://forums.phpfreaks.com/topic/133047-solved-please-help-me-debug-this-script/#findComment-691936 Share on other sites More sharing options...
Blesbok Posted November 17, 2008 Author Share Posted November 17, 2008 wow, thank you vbnullchar, you're a star! i still couldn't see it -- until i posted the two versions (lines) one under the other! lol beyond any doubt, you've made my day blessings! Bill Blesbok Link to comment https://forums.phpfreaks.com/topic/133047-solved-please-help-me-debug-this-script/#findComment-691945 Share on other sites More sharing options...
vbnullchar Posted November 18, 2008 Share Posted November 18, 2008 no problem glad to help Link to comment https://forums.phpfreaks.com/topic/133047-solved-please-help-me-debug-this-script/#findComment-692447 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.