doushuhuai7247 2011-07-25 11:02
浏览 23
已采纳

怎么在Drupal 6中安排Block?

I am a newbie in Drupal, I just created a module and try to display. But the block HTML code breaks all boundaries of the Theme. How we can control the HTML in blocks ?

For example my block code is

function node_example_block($op='list',$delta=0){

    switch($op){
        case "list":
            $block[0]['info'] = t('THIS IS EXAMPLE NODE EXAMPLE ');
            return $block;
        case "view":    
            $block['subject'] = "THIS MY FIRST SAMPLE BLOCK";
            $block['content'] = get_tree_data();

            return $block;
    }
}

function get_tree_data(){

    /*
     $output = HTML CODES HERE .....
    */
     }

return $output;
}
  • 写回答

2条回答 默认 最新

  • du131642 2011-07-25 14:47
    关注

    I am not sure what you mean by "breaks all boundaries of the theme". If that means that your theme goes wrong when you use that block, then the answer is simply that your HTML is wrong - it may contain unclosed HTML tags for instance.

    The only answer to that is to fix your HTML. You may want to use Drupal's HTML corrector to see if that is indeed the problem :

    function get_tree_data() {
      /* fill $output */      
      return filter_filter('process', 3, -1, $output); /* Call htmlcorrector filter */
    }
    

    But I wouldn't recomend keeping it this way, as having a bug in your HTML could merely be a symptom of a bigger bug which you should fix.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?