Hey all. I have been working on customizing a nifty little microblog called Asaph (http://asaph.phoboslab.org/) and am now trying to integrate a bit of my wordpress blog into it. I am having a problem with some conflicting php. The two parts are: <?php require('../wp-blog-header.php'); ?> <?php $posts = get_posts('numberposts=2'); foreach ($posts as $post) : start_wp(); ?> <div class="flop"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a> <?php the_excerpt(); ?> </div> <?php endforeach; ?> <div class="flop"> <?php query_posts('showposts=3'); ?> <?php while (have_posts()) : the_post(); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a><br /> <?php endwhile; ?> </div> Code (markup): The above is included inside this next piece of code via "wp_include.html" <?php include ('wp_include.html'); ?> <?php foreach( $posts as $p ) { ?> <div class="post"> <?php if( $p['image'] ) { ?> <a href="<?php echo $p['image']; ?>" rel="lightbox" title="<?php echo $p['title']; ?>" class="Tips"> <img src="<?php echo $p['thumb']; ?>" alt="<?php echo $p['title']; ?>" /> </a> <?php } else { ?> <p> <a href="<?php echo $p['source']; ?>"><?php echo nl2br($p['title']); ?></a> </p> <?php } ?> <div class="postInfo"> <a href="<?php echo $p['source']; ?>"><?php echo $p['sourceDomain']; ?> <span style="font-size: 110%;font-style:normal;">→</span> </a> </div> </div> <?php } ?> <br class="clear"/> </div> <div id="pages"> <div class="pageInfo"> page <?php echo $pages['current']; ?> of <?php echo $pages['total']; ?> </div> <div class="pageLinks"> <?php if( $pages['prev'] ) { ?> <a href="<?php echo ASAPH_LINK_PREFIX.'page/'.$pages['prev']?>">« prev</a> <?php } else { ?> « prev <?php } ?> / <?php if( $pages['next'] ) { ?> <a href="<?php echo ASAPH_LINK_PREFIX.'page/'.$pages['next']?>">next »</a> <?php } else { ?> next » <?php } ?> </div> Code (markup): Now I know something is going on here because if I include the wordpress code after the rest of the code it works perfectly. However including it where it is now causes only the wordpress content to show up while everything below becomes blank. Could it be something to do with $post being in both chunks but referring to different things? (asaph posts and wordpress posts). I haven't spent much time with php so if anyone can point me in the right direction I would be very greatful.
yes that sounds like it could be the problem, try changing the wordpress code to $wp_posts and that should fix the problem from what i can see. it would appear they are both expecting different data form the same variable which is obviously not a good thing
Thanks for the quick reply! I did change the variables but now I run into yet another problem. I am getting: Fatal error: Cannot use object of type stdClass as array in /mnt/gs02/herd03/31107/domains/internetjogging.com/html/things/templates/whiteout/posts.html.php on line 25 I believe I am suppose to then change line 25 which is: <?php if( $p['image'] ) { ?> Code (markup): to <?php if( $p->image ) { ?> Code (markup): it gave me the same error for about 4 other lines. I fixed them all and the errors went away but functionality was essentially gone as pictures and posts related to asaph no longer show up Any ideas?