• Hello, i’m trying to password protect a template. If the user is logged; the posts are show, else there is a message with a login box.
    Problem : I don’t understand how their code is written (with the while, :, ?, endwhile, etc) and I get an error :
    Parse error: syntax error, unexpected T_ELSE in /home/foliosco/public_html/wordpress/wp-content/themes/default/category-12.php on line 48

    Here is my code and what I add is in bold. (it’s an example, the login system isn’t build yet)

    <?php
    if ($_GET[‘logged’]==’true’) { ?>

    <?php while (have_posts()) : the_post(); ?>

    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <h2>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></h2>
    <small><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></small>

    <div class=”entry”>
    <?php the_content(‘Read the rest of this entry »’); ?>
    </div>

    <p class=”postmetadata”>Posted in <?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Edit’, ”, ‘ | ‘); ?> <?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments »’); ?></p>
    </div>

    <?php endwhile; ?>

    <div class=”navigation”>
    <div class=”alignleft”><?php next_posts_link(‘« Previous Entries’) ?></div>
    <div class=”alignright”><?php previous_posts_link(‘Next Entries »’) ?></div>
    </div>

    <?php else : ?>

    <h2 class=”center”>Impossible de trouver la page</h2>
    <p class=”center”>Désolé, mais la page n’a pas été trouvée !</p>
    <?php include (TEMPLATEPATH . “/searchform.php”); ?>

    <?php endif; ?>

    <?php
    } else {
    echo “not logged”;
    }

    ?>

  • The topic ‘Problem when trying to password-protect a template’ is closed to new replies.