Viewing 2 replies - 1 through 2 (of 2 total)
  • I just figured this one out for myself. There is a php function, ob_start, that stops all outputing to the user and stores it in a buffer. You use ob_get_contents() to store the contents in a variable, then ob_end_clean() to stop storing output data into the buffer and clear the buffer also, rather than outputing it to the user, like ob_end_flush() would.

    Example:

    ob_start();
    	if (have_posts()) :
    		while (have_posts()) : the_post();
    		the_content('strip_teaser=TRUE');
    		$post=ob_get_contents();
    		endwhile;
    	endif;

    ob_end_clean();

    Thread Starter fireundubh

    (@fireundubh)

    Thank you. I found an alternative solution to my problem though.

    <li>
    	<h2><?php _e('Multimedia'); ?></h2>
    	<ul style="margin-left:0;">
    	<?php
    		query_posts('category_name=Multimedia&showposts=5');
    		if(have_posts()): while(have_posts()): the_post();
    	?>
    		<li><strong><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php $event1 = the_title("", "", 0); $event2 = str_replace('Media: ', ' ', $event1); echo $event2; ?></a></strong></li>
    	<?php endwhile; endif; ?>
    	</ul>
    </li>

    At least, I think it was that one… Maybe not.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘the_content() as a string variable?’ is closed to new replies.