0
사용자가 로그인하지 않았을 때 그래픽을 표시하기 위해 PHP if 문을 사용하고 있지만 그 문제는 다음과 같습니다.) PHP는 아직 좋지 않지만 b) if 내 오른쪽 사이드 바를 내 #contentleft
div에 넣고 형제가되어야합니다. 내가 여기서 뭘 잘못하고 있는지 말해 줄 수 있니?php, div 중첩 문제
코드 :
<div id="contentleft">
<?php
if (is_user_logged_in()) {
echo 'Welcome, registered user!';
} else {
echo '<div id="intro"><p><a href="http://www.wespeakfashion.com/submissions">Sign up</a> and start posting!</p></div>';
};
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<p class="date"><b>Posted on</b> | <?php the_time('F j, Y'); ?> | <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></p>
<?php global $wpdb;
$query = "SELECT `ID`, `guid` FROM `$wpdb->posts` WHERE `post_type` = 'attachment' AND `post_parent` = '{$post->ID}'";
$adimages = $wpdb->get_results($wpdb->prepare($query), OBJECT);
// To display the first image.. ?>
<img style="float: center; height: 500px;" src="<?php if(is_public_submission()){echo $adimages[0]->guid;} ?>" />
<?php the_content(__('Read more'));?><div style="clear:both;"></div>
<div class="bt-links"><strong>Category:</strong> <?php the_category(', ') ?><br /><?php the_tags('<strong>Tags:</strong> ',' > '); ?></div>
<!--
<?php trackback_rdf(); ?>
-->
<h3>Comments</h3>
<?php comments_template(); // Get wp-comments.php template ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p><?php endif; ?>
</div>
<?php include(TEMPLATEPATH."/r_sidebar.php");?>
</div>
감사 무리.
네,이 문제가 발생했습니다. 아마도이 해결책을 제시 할 것입니다. 이상한 것은 저에게'# r_sidebar'는 내가 로그인 할 때'contentleft'의 형제입니다. 그러나 로그 아웃 할 때 그 자식이됩니다. PHP를 직접 작성하고 있기 때문에 if 문과 관련이 있다고 생각했습니다. 고마워, 앤드류 프롭. – blackessej