Posted by mhurston on January 7, 2013 at 1:52am
I am setting upa simple drupal 7 install that will server as a blog and content aggregator for another site. The project is done using a theme with 2 files, the first is page--front.tpl.php and page.tpl.php - whcih actually use the same exact code shown below. The problem I am having is that when I attempt to add a block to the right o left sidebar area, it does not show, even though I have the php snippet in my template for both.
<header> custom header stuff in html, not very exciting </header>
<?php if ($page['sidebar_first']): ?>
<div id="sidebar-first" class="sidebar">
<?php print render($page['sidebar_first']); ?>
</div>
<?php endif; ?>
<div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner">
<?php print $breadcrumb; ?>
<?php if ($page['highlighted']): ?><div id="highlighted"><?php print render($page['highlighted']); ?></div><?php endif; ?>
<a id="main-content"></a>
<?php if ($tabs): ?><div id="tabs-wrapper" class="clearfix"><?php endif; ?>
<?php print render($title_prefix); ?>
<?php if ($title): ?>
<h1<?php print $tabs ? ' class="with-tabs"' : '' ?>><?php print $title ?></h1>
<?php endif; ?>
<?php print render($title_suffix); ?>
<?php if ($tabs): ?><?php print render($tabs); ?></div><?php endif; ?>
<?php print render($tabs2); ?>
<?php print $messages; ?>
<?php print render($page['help']); ?>
<?php if ($action_links): ?><ul class="action-links"><?php print render($action_links); ?></ul><?php endif; ?>
<div class="clearfix">
<?php print render($page['content']); ?>
</div>
<?php print $feed_icons ?>
<?php print render($page['footer']); ?>
</div></div></div></div> <!-- /.left-corner, /.right-corner, /#squeeze, /#center -->
<?php if ($page['sidebar_second']): ?>
<div id="sidebar-second" class="sidebar">
<?php print render($page['sidebar_second']); ?>
</div>
<?php endif; ?>
<footer> custom footer stuff in html, not very exciting </footer>
Comments
=-=
are the regions defined in your theme .info file?
I have the following regions
I have the following regions defined in my info file:
regions[header] = Header
regions[help] = Help
regions[page_top] = Page top
regions[page_bottom] = Page bottom
regions[highlighted] = Highlighted
regions[featured] = Featured
regions[content] = Content
regions[sidebar_first] = Sidebar first
regions[sidebar_second] = Sidebar second
regions[triptych_first] = Triptych first
regions[triptych_middle] = Triptych middle
regions[triptych_last] = Triptych last
regions[footer_firstcolumn] = Footer first column
regions[footer_secondcolumn] = Footer second column
regions[footer_thirdcolumn] = Footer third column
regions[footer_fourthcolumn] = Footer fourth column
regions[footer] = Footer
=-=
just to be clear since the title of this thread says front--page.tpl.php (though you mention page--front.tpl.php in the body text). The naming convention is important. Which is being used?
page--front.tpl.php and
page--front.tpl.php and page.tpl.php since it's a drupal 7 site
I actually got the sidebars to load now...BUT they are only showing up above or below the content - not sure if thisis a css issue or if something is wrong with my regions.
To get them to show up I replaced my previous drupal code with the following:
<div id="drupalcontent">
<?php if ($messages): ?>
<div id="messages"><div class="section clearfix">
<?php print $messages; ?>
</div></div> <!-- /.section, /#messages -->
<?php endif; ?>
<?php if ($page['featured']): ?>
<div id="featured"><div class="section clearfix">
<?php print render($page['featured']); ?>
</div></div> <!-- /.section, /#featured -->
<?php endif; ?>
<div id="main-wrapper" class="clearfix"><div id="main" class="clearfix">
<?php if ($breadcrumb): ?>
<div id="breadcrumb"><?php print $breadcrumb; ?></div>
<?php endif; ?>
<?php if ($page['sidebar_first']): ?>
<div id="sidebar-first" class="column sidebar"><div class="section">
<?php print render($page['sidebar_first']); ?>
</div></div> <!-- /.section, /#sidebar-first -->
<?php endif; ?>
<div id="content" class="column"><div class="section">
<?php if ($page['highlighted']): ?><div id="highlighted"><?php print render($page['highlighted']); ?></div><?php endif; ?>
<a id="main-content"></a>
<?php print render($title_prefix); ?>
<?php if ($title): ?>
<h1 class="title" id="page-title">
<?php print $title; ?>
</h1>
<?php endif; ?>
<?php print render($title_suffix); ?>
<?php if ($tabs): ?>
<div class="tabs">
<?php print render($tabs); ?>
</div>
<?php endif; ?>
<?php print render($page['help']); ?>
<?php if ($action_links): ?>
<ul class="action-links">
<?php print render($action_links); ?>
</ul>
<?php endif; ?>
<?php print render($page['content']); ?>
<?php print $feed_icons; ?>
</div></div> <!-- /.section, /#content -->
<?php if ($page['sidebar_second']): ?>
<div id="sidebar-second" class="column sidebar"><div class="section">
<?php print render($page['sidebar_second']); ?>
</div></div> <!-- /.section, /#sidebar-second -->
<?php endif; ?>
</div></div> <!-- /#main, /#main-wrapper -->
<?php if ($page['triptych_first'] || $page['triptych_middle'] || $page['triptych_last']): ?>
<div id="triptych-wrapper"><div id="triptych" class="clearfix">
<?php print render($page['triptych_first']); ?>
<?php print render($page['triptych_middle']); ?>
<?php print render($page['triptych_last']); ?>
</div></div> <!-- /#triptych, /#triptych-wrapper -->
<?php endif; ?>
</div> <!-- /#drupal content end -->
Just wanted to follow up. I
Just wanted to follow up. I ended up getting super lazy with this project so I stuck my page.tpl files into Bartik's theme directory and turned on Bartik - everything works now :)