I have my wordpress theme template files split up into different columns. On my category pages I want to grab the category slug and run it through custom loops to get the content from the category in question. So essentially my category.php looks a bit like this (simplified):
<?php if (have_posts()) : ?><!-- Start the Loop. -->
<?php $thiscategory = get_the_category();
$slug = $thiscategory[0]->category_nicename; ?>
<div id="divcolumns">
<div id="col-left" class="home"><?php get_template_part('category','leftcol'); ?></div>
<div id="col-center" class="cat"><?php get_template_part('category','centercol'); ?></div>
</div>
<?php endif; ?><!-- end the loop -->
And then within the content files I'm using query posts with the variable $slug. e.g. "category_name=$slug&posts_per_page=1".
How can I pass the variable $slug between my template files? Or is there a better way of getting the current category within an included file?