Conditional Content Display

You can’t execute PHP code from within a string.

You can however define a function that executes code and call that function within your if clauses.

function dz_slick_longstring() {
    $query = new WP_Query('category_name=intro-paragraphs');

    if($query->have_posts()) : while($query->have_posts()) : $query->the_post();
        <div class="mid-box">
          <h1><?php the_title(); ?></h1>
          <?php echo excerpt(40); ?><br/>
          <a href="<?php echo get_permalink(); ?>">&raquo; read more...</a>
    <!-- End Mid-Box -->
    <?php endwhile; ?>
    <?php endif; ?>

Then instead of doing this:

if ($link == '1'){
         echo $longString;

Do This:

if ($link == '1'){