[英]Drupal Block not showing on the page
$blocks['onemore'] = array(
'info' => t('onemore'),
'status' => TRUE,
'region' => 'content',
'weight' => 0,
'cache' => DRUPAL_NO_CACHE,
'visibility' => BLOCK_VISIBILITY_LISTED,
'pages' => 'admin/structure/nodequeue/1/view/1',
);
Problem - The above block shows up and works perfectly and as expected at 'admin/structure/nodequeue/1/view/1' 问题-上面的代码块显示并正常运行,并且在'admin / structure / nodequeue / 1 / view / 1'上正常运行
My problem is that I need to declare dynamic amounts of blocks based on the users inputs. 我的问题是我需要根据用户输入声明动态数量的块。 So I wrote a db fetch and for each loop.
因此,我为每个循环编写了一个db fetch。 If I do this then the block shows up in 'admin/modules' but the it is not in 'content' region for the seven theme.
如果执行此操作,则该块将显示在“ admin / modules”中,但它不在这七个主题的“ content”区域中。 As I want to show it there.
我想在那里展示。
I have double checked the values and even the admin/structure/block/manage/xdmp/onemore/configure has the value but the region is not selected. 我已经仔细检查了值,甚至admin / structure / block / manage / xdmp / onemore / configure都具有该值,但是未选择区域。
I am assuming there is some conflict in the for each loop or the db query. 我假设每个循环或db查询中都有一些冲突。 Please advice your thoughts on it.
请提出您的想法。
function xdmp_block_info() {
$blocks = array();
// Here we are going to do a db query so that I can get a list of
// block ids to declare
$resultxdmp = db_query("
SELECT * FROM xdmp_container_list ");
foreach($resultxdmp as $resultRecords)
{
$xdmp_nodeque_id_to_display =(int)$resultRecords->xdmp_nodequeue_id;
$xdmp_nodeque_id_to_display = intval($xdmp_nodeque_id_to_display);
$xdmp_path_to_show_block = 'admin/structure/nodequeue/'.$xdmp_nodeque_id_to_display.'
/view/'.$xdmp_nodeque_id_to_display.'';
$xdmp_machinenameofblock=(string)$resultRecords->xdmp_container_machine_name;
$xdmp_nameofblock=(string)$resultRecords->xdmp_container_name;
$blocks[$xdmp_machinenameofblock] = array(
'info' => t($xdmp_nameofblock),
'status' => TRUE,
'region' => 'content',
'weight' => 0,
'cache' => DRUPAL_NO_CACHE,
'visibility' => BLOCK_VISIBILITY_LISTED,
'pages' => $xdmp_path_to_show_block,
);
} // end for for each
return $blocks;
}
cheers, Vishal 欢呼,维沙尔
Are you sure the 'content'
region is valid? 您确定
'content'
区域有效吗? If it's not, it of course can't show up :) 如果不是,它当然不会出现:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.