Conflict with While statement

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wiriche
Forum Newbie
Posts: 1
Joined: Thu Apr 16, 2009 4:47 pm

Conflict with While statement

Post by wiriche »

Hello to everyone... I'm new and don't know PHP... this is why I'm here! looking for help :o

I'm working with my portfolio theme! on wordpress. My index.php file have this code

Code: Select all

<?php get_header(); ?>
<?php if (is_page('portfolio')) : ?>
 
    <div id="portfolio">  
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>  
        <h1><?php the_title(); ?></h1> 
        <div id="post"><?php the_content(); ?></div> 
        <?php endwhile; else: ?>  
        <h1>Woops...</h1>  
        <p>Sorry, no posts we're found.</p>  
    <?php endif; ?>  
    <p align="center"><?php posts_nav_link(); ?></p>  
    </div>
 
<?php elseif (is_page('home')) : ?>
 
    <div id="content">  
[color=#FF0000]<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>  [/color]
        <h1><?php the_title(); ?></h1>
        <div id="post">
[color=#FF0000]<?php include (TEMPLATEPATH . "/slide.php"); ?>[/color]
            <?php the_content(); ?>
        </div> 
        <?php endwhile; else: ?>
        <h1>Woops...</h1>  
        <p>Sorry, no posts we're found.</p>  
    <?php endif; ?>
 
    <p align="center"><?php posts_nav_link(); ?></p>  
    </div>
[/color]
<?php else : ?>
 
    <div id="content">  
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>  
        <h1><?php the_title(); ?></h1> 
        <div id="post"><?php the_content(); ?></div> 
        <?php endwhile; else: ?>
        <h1>Woops...</h1>  
        <p>Sorry, no posts we're found.</p>  
    <?php endif; ?>  
    <p align="center"><?php posts_nav_link(); ?></p>  
    </div>
 
<?php endif; ?>
 
<?php if (is_page('portfolio')) : ?>
    <?php else : ?>
        <?php if (is_page('contact-me')) {
            include(TEMPLATEPATH . '/sidebar-contact.php');
            } elseif ( is_page('about-me')) {
            include(TEMPLATEPATH . '/sidebar-about.php');
            } else {
            include(TEMPLATEPATH . '/sidebar.php');
        }
    ?> 
<?php endif; ?>
<?php get_footer(); ?> 
 
As you can see on line 18 there is a while statement and on line 21
I have included the slide.php file.

The slide php file have this code

Code: Select all

 
<script type="text/javascript">
stepcarousel.setup({
    galleryid: 'mygallery', //id of carousel DIV
    beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
    panelclass: 'panel', //class of panel DIVs each holding content
    panelbehavior: {speed:500, wraparound:true, persist:true},
    defaultbuttons: {enable: true, moveby: 1, leftnav: ['http://web2feel.com/images/rem1.jpg', -14, 60], rightnav: ['http://web2feel.com/images/rem2.jpg', 0, 60]},
    statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
    contenttype: ['external'] //content setting ['inline'] or ['external', 'path_to_external_file']
})
</script>
<div id="mygallery" class="stepcarousel">
<div class="belt">
<?php 
    $slidecat = get_option('william_slide_category'); 
    $slidecount = get_option('william_slide_count');
    
    $my_query = new WP_Query('category_name= '. $slidecat .'&showposts='.$slidecount.'');
[color=#FF0000]while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID; [/color]
?>
<div class="panel">
<?php $homethumb = get_post_meta($post->ID,'homethumb', true); ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" ><img src="<?php bloginfo('url'); ?>/portfolio/wp-content/uploads/<? echo strtolower($homethumb); ?>.jpg" alt="<?php the_title(); ?>"/></a>
</div>
[color=#FF0000]<?php endwhile; ?>[/color]
</div>
</div>
 
The slide.php file have another while statement on line 20 and close the while statement on line 26.
The problem is that the code after the line 21 on index.php isn't working or isn't loading. I can't see my content (line22 index.php).
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Re: Conflict with While statement

Post by aaronhall »

Turn your errors on

Code: Select all

ini_set('display_errors', 'On');
error_reporting(E_ALL | E_NOTICE);
Post Reply