为什么不';这段代码的作用是检查一个区域是否被占用


Why doesn't this code work to check if a region is occupied?

我的主题中有下面的代码来检测leftsidebar区域中是否有块。问题是,这个HTML代码仍然在leftsidebar区域中没有块的页面上得到输出。我完全不知道问题出在哪里。我用其他块做了同样的代码,它也能工作。

这是我的page.tpl.php文件中的代码。。。

<?php if (!$page['sidebar']): ?>
<div id="content-area" class="one-col">
<?php endif; ?> 
<?php if ($page['sidebar'] && !$page['leftsidebar']): ?>
<div id="content-area" class="two-col">
<?php endif; ?> 
<?php if ($page['leftsidebar']): ?>
<div id="content-area" class="three-col">
<?php endif; ?> 

这是我.info文件中的块区域。。。

regions[leftsidebar] = Left Sidebar

只需检查<?php if($leftsidebar): ?>。然后添加所有标记。

相关文章: