我有基本页面节点,我使用混沌工具页面管理器(用于面板)来覆盖node / x的页面,当加载node / x时,我想要显示的面板开始并仍然将节点加载到新的页面,但它似乎不再呈现CCK元素。当将节点内容放入面板时,我已经取消选中“没有额外内容”,仍然没有运气。
我正在mytheme_preprocess_page中使用我需要的渲染CCK字段,并且对于未被覆盖的所有节点都可以正常工作,在被覆盖的1s节点打印出来,它似乎只是加载一些节点信息,如下所示
stdClass Object ( [nid] => 26 [type] => page [language] => [uid] => 1 [status] => 1 [created] => 1291494499 [changed] => 1291495256 [comment] => 0 [promote] => 0 [moderate] => 0 [sticky] => 0 [tnid] => 0 [translate] => 0 [vid] => 26 [revision_uid] => 1 [title] => title here [body] => content here [log] => [revision_timestamp] => 1291495256 [format] => 2 [name] => admin [picture] => [data] => a:0:{} [path] => home [field_page_banner] => Array ( [0] => Array ( [fid] => 28 [list] => 1 [data] => Array ( [alt] => [title] => ) [uid] => 1 [filename] => 28-26.png [filepath] => sites/default/files/page-banners/28-26.png [filemime] => image/png [filesize] => 4627 [status] => 1 [timestamp] => 1291494487 [origname] => page-banner.png )你可以看到它似乎永远不会完全渲染节点,我需要渲染template.php中使用的CCK字段[1] => Array ( [fid] => 29 [list] => 1 [data] => Array ( [alt] => [title] => ) [uid] => 1 [filename] => 28-26.png [filepath] => sites/default/files/page-banners/28-26_0.png [filemime] => image/png [filesize] => 5292 [status] => 1 [timestamp] => 1291495241 [origname] => pruple-page-banner.png ) [2] => Array ( [fid] => 30 [list] => 1 [data] => Array ( [alt] => [title] => ) [uid] => 1 [filename] => 28-26.png [filepath] => sites/default/files/page-banners/28-26_1.png [filemime] => image/png [filesize] => 5209 [status] => 1 [timestamp] => 1291495252 [origname] => green-page-banner.png ) ) [field_homepage_block] => Array ( [0] => Array ( [value] => ) ) [field_homepage_block_order] => Array ( [0] => Array ( [value] => ) ) [field_homepage_block_image] => Array ( [0] => ) [last_comment_timestamp] => 1291494499 [last_comment_name] => [comment_count] => 0 [taxonomy] => Array ( )
)
我错过了什么吗?
感谢
答案 0 :(得分:0)
找到了一个有效的解决方案,在template.php中我必须手动调用drupal_render来获取内容类型,用于渲染cck字段,现在工作正常!
if(in_array($node->type, $banner_node_types)){ if(!$node->content['field_page_banner']['#children']){ $node->build_mode = 'full'; $node = node_build_content($node); drupal_render($node->content); } $page_banner = $node->content['field_page_banner']['#children']; $vars['page_banner'] = $page_banner; }
如果有更好的方式请告诉我!谢谢:D