Q:

Using different wordpress loop output depending on category

I am trying to create a somewhat advanced wordpress loop for a new website. I would like to display all recent posts on the front page, but differently depending on chosen category.
I am thinking something like this:
Start Loop

Check if category = category 1

If category = category 1:

<-- Loop elements for said category (template tags etc.) -->

Else, check if category = category 2

If category = category 2 

<-- Loop elements for said category (template tags etc.) -->

Else

<-- Standard loop elements (template tags etc.) -->

End loop

Is this possible? Are there simpler ways to do this? I realize i could use multiple loops, but would like to keep the posts in chronological order.
I tried using the following code, but this breaks when i put the template tags in the echo?
<?php
$category_name = 'Category 1';
if(in_category($category_name)) {
  echo '

<div class="post">
the_title();
the_excerpt();
<div>

';
}
?>

Any help much appreciated :)

A:

Try
<?php
$category_name = 'Category 1';
if(in_category($category_name)) {
?>

<div class="post">
<?php the_title(); ?>
<?php the_excerpt(); ?>
<div>

<?php
}
?>

