Reputation: 2588
I am setting up a search page in Drupal 7 and when I click on Search something after entering a keyword, it just shows me an empty page.tpl.php
. page. In other words, it just shows me the page.tpl.php
template with no result in it.
It is actually surprising for me. The search page is not supposed to show page.tpl.php
template but it is showing that template. I enabled Search module and search-result.tpl.php
and search-results.tpl.php
is in my theme folder; but still it is showing me page.tpl.php
template. When I remove page.tpl.php
however, it works perfectly. Any idea why this is happening? –
Is there a way to fix it? Why is it happening? How can I just create a search page template (like page--search--results.tpl.php) and it just reads that?
Many Thanks
<?php
/**
* @file
* Theme implementation to display a single Drupal page.
*
*
* @see template_preprocess()
* @see template_preprocess_page()
*/
?>
<div class="wrapper">
<!--Header-->
<header>
<div id="top">
<?php global $base_url; ?>
<div id="logo">
<?php if ($logo): ?>
<a href="<?php print $front_page; ?>"><img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" /></a>
<?php else: ?>
<?php if ($site_name): ?>
<h1 id="logo-text"><a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>"><?php print $site_name; ?></a></h1>
<?php endif; ?>
<?php endif; ?>
</div>
<div id="searc"> <img src="<?php echo $base_url."/jkl/".$directory ?>/images/MK.jpg" id="mk" width="227" height="51" border="0" alt="Company Company">
<form class="lmksearch">
<input type="search" name="s" value="" class="searchbox">
</form>
</div>
</div>
<!-- Menu -->
<div id="menu">
<?php if ($main_menu): ?>
<div class="nav">
<?php print theme('links__system_main_menu', array(
'links' => $main_menu,
'attributes' => array(
'id' => 'main-menu-links',
'class' => array('links', 'clearfix'),
),
'heading' => array(
'text' => t('Main menu'),
'level' => 'h2',
'class' => array('element-invisible'),
),
)); ?>
</div>
<?php endif; ?>
</div>
<!--menu-->
</header>
<!--Header END-->
<!--content-->
<div class="c"></div>
<div class="content-wrapper">
<div class="teaser-content-cat">
<div class="page-title">Publication: <?php print $node->field_category['und'][0]['taxonomy_term']->name; ?></div>
<!-- White Canvas on Black Starts here -->
<div class="content-canvas">
<div class="article-node left left-side">
<!-- article would come here -->
<h3><?php echo $node->title; ?></h3>
<p class="teaser-content-desc"><?php print $node->field_month['und'][0]['value']; ?> | <?php print $node->field_author_s_['und'][0]['value']; ?> </p>
<p>
<div class="content-from-admin">
<?php if ($search_results) : ?>
<?php include "search-result.tpl.php" ; ?>
<?php endif; ?>
<p class="article-subhead"><?php print $node->field_subtitle['und'][0]['value']; ?></p>
<?php echo $node->body['und'][0]['value']; ?>
</div>
</p>
</div>
<!-- Side bar -->
<div id="viewrow" class="right right-side">
<?php print render($page['sidebar_first']); ?>
<!-- Sidebar -->
</div>
<!-- Clearing Both Left and Right Floating Elements. -->
<div class="c"></div>
<!-- View Row Ends -->
</div>
<!-- White Canvas Ends -->
</div>
<!--Footer-->
<div class="footer">
<?php print render($page['footer']); ?>
</div>
<!-- Teaser Ends -->
</div>
<!--Wrapper end-->
</div>
</body>
</html>
Upvotes: 0
Views: 5677
Reputation: 2456
Check the template suggestions for Drupal 7.
If you need to change the whole page template you have to use page--search.tpl.php or page--search--node.tpl.php respectively (if your path is /search/node). Because search-results.tpl.php is the default wrapper for search results inside page not for the page.
Edit after the submitted page.tpl.php code:
You are missing the <?php print render($page['content']); ?>
in the page.tpl.php file! Please follow the Drupal Theming documentation guide.
Upvotes: 1