I'm using Views for my Ubercart site's search, with an exposed filter block along with 2 other exposed filters. However, I only want the input and submit button to be in the block and the 2 exposed filters to be on the page of results. Instead, everything is put in the block.
I created views-exposed-form--search-results.tpl.php and took out everything except the input and submit buttons, but now I'm not sure how to put the removed elements on my search page. I created views-view--search-results.tpl.php but if I use the same code I took out from views-exposed-form.tpl.php, nothing shows up. I'm assuming this is because some or all of the variables aren't available.
My question is (assuming this is the problem), how do I make those variables available to views-view--search-results.tpl.php? I'm assuming this will involve a preprocess function of some sort, but I have very little experience with them, so I don't know where to begin. Here's what I want to move to views-view--search-results.tpl.php:
<div class="views-exposed-form">
<div class="views-exposed-widgets clearfix">
<?php if (!empty($sort_by)): ?>
<div class="views-exposed-widget views-widget-sort-by">
<?php print $sort_by; ?>
</div>
<div class="views-exposed-widget views-widget-sort-order">
<?php print $sort_order; ?>
</div>
<?php endif; ?>
<?php if (!empty($items_per_page)): ?>
<div class="views-exposed-widget views-widget-per-page">
<?php print $items_per_page; ?>
</div>
<?php endif; ?>
<div class="views-exposed-widget views-submit-button">
<?php print $button; ?>
</div>
</div>
</div> Hope I'm not way off here. Any suggestions would be greatly appreciated!
Comments
Devel/krumo
Not sure exactly how to solve this problem, but I can help you to see all the variables you have available in any template.
First install the Devel module which comes with Krumo, a library for rendering variable dumps in a readable way.
Then, at the top of your template (or anywhere), add this line of PHP:
<?phpkrumo(func_get_args());
?>
When you reload your page you should see a Yellow (I think that is the default color) widget that contains all your variable information.
Maybe having access to the variables will help you figure this out.
--
Nathan Rambeck
Thanks Nathan! I was having
Thanks Nathan! I was having issues with Devel Themer (doesn't like Omega theme apparently, http://drupal.org/node/1081758), so this is a good alternative. I don't see any of the variables that I need, so now it's a question of how to make them available in my new template. My Drupal books cover how to add new variables, and change existing ones already available, but I'm not sure how to use variables from other templates... if that makes sense.