Hello eveeryone,
I'm using some code to isolate the images and text of a post to either side of the page. Like this...
<div id="content">
<?php $id = $_GET['p']; ?>
<?php query_posts( 'p='.$id.'' ); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div id="focustext">
<a href="<?php the_permalink(); ?>"><h1><?php the_title(); ?></h1></a>
<small><b>Posted: </b><?php the_time('F jS, Y') ?> | <b>By: </b><?php the_author_posts_link(); ?> | <b>Subject: </b><?php the_category(', ') ?></small>
<?php $posttext = $post->post_content;
$posttext1 = $post->post_content;
$regular_expression = '~src="[^"]*"~';
$regular_expression1 = '~<img [^\>]*\ />~';
preg_match_all( $regular_expression, $posttext, $allpics );
$NumberOfPics = count($allpics[0]);
$only_post_text = preg_replace( $regular_expression1, '' , $posttext1);
echo "<p>".$only_post_text."</p>";
?>
</div>
<div id="focussideimg">
<?php if ( $NumberOfPics > 0 ){
for ( $i=0; $i < $NumberOfPics ; $i++ ){
$str1=$allpics[0][$i];
$str1=trim($str1);
$len=strlen($str1);
$imgpath=substr_replace(substr($str1,5,$len),"",-1);
?>
<?php echo "<img src=\"$imgpath\" alt=\"\"/>" ?>
<?php }; };?>
<?php endwhile; endif; ?>
</div>
</div>
<div id="wgp-10">
<?php get_footer(); ?>
</div>
</body>
</html>
It works perfectly on my WAMP server offline. But when I upload it - I get a parse error "Parse error: syntax error, unexpected T_ELSE" apparently on line 33. I've checked and rechecked my syntax, and am pretty sure I dont have any open If/with/for/else clauses but It may be my all nighter eyes.
Any help would be super great!
Thanks