Jump to content

Syntax Error


Mr.Canuck

Recommended Posts

I am getting this error for my contact.php page: Parse error: syntax error, unexpected '<' in /home/freewe8/public_html/kmkwebdesign.ca/clients/dejavu/wp-content/themes/Dejavu/contact.php on line 85

 

Not sure how to fix it. Any help would be appreciated. Code below:

 

<?php
/*-------------------------------*/
/* Template Name: Contact Page
/*-------------------------------*/
get_header();?>
<div class="blog">
<?php if(get_option('breadcrumbs') == 'yes') { ?>
<div class="blog-info">
 <?php the_breadcrumb();?>
</div>
<?php if(get_option('breadcrumbs_search') != 'no') { get_template_part('search_form'); } } ?>
<div id="main">
 <?php if(have_posts()) { while(have_posts()) { the_post();?>
 <div id="post-<?php the_ID();?>">
  <div class="contact-item">
   <?php if(has_post_thumbnail()) { the_post_thumbnail();?>
   <img src="<?php echo get_template_directory_uri();?>/images/image_shadow_680.png" style="margin-top: -6px" class="semi_trans" />
   <?php } ?>
   <div style="clear:both"></div>
   <div class="post-title" style="margin-bottom: 30px<?php if(has_post_thumbnail()) { ?>;padding-top: 10px<?php } ?>">
 <?php the_title(); ?>
   </div>
   <div style="clear:both"></div>
   <div class="post-content">
 <?php the_content();?>
   </div>
   <?php if(get_option('google_map') != '') { ?>
   <div class="google-map">
 <?php echo stripslashes(get_option('google_map'));?>
   </div>
   <?php }
   //If the form is submitted
   if(isset($_POST['submittedPage'])) { get_template_part('includes/submit-page'); } if(isset($emailSent) && $emailSent == true) { ?>
   <p class="thanks"><?php if(get_option('thankyou_message') != "") { echo get_option("thankyou_message"); } else { ?><strong>Thanks!</strong> Your message has been sent.<?php } ?></p>
   <?php } else { if(isset($captchaError)) { ?>
   <p class="error">There was an error submitting the form.<p>
   <?php } if(get_option('contact_form_title') != '') { ?>
   <h3><?php echo get_option('contact_form_title');?></h3>
   <?php } ?>
   <a name="#reload"></a>
   <form action="<?php the_permalink();?>" id="contactFormPage" method="post">
 <label class="textfield_label" for="contactNamePage">Name: *</label>
 <p>
  <input type="text" name="contactNamePage" id="contactNamePage" value="<?php if(isset($_POST['contactNamePage'])) { echo $_POST['contactNamePage']; } ?>" class="page_requiredField textfield<?php $nameError = isset($nameError) ? $nameError : '';if($nameError != '') { echo ' inputError'; } ?>" size="22" tabindex="5" />
 </p>
 <label class="textfield_label" for="emailPage">Email: *</label>
 <p>
  <input type="text" name="emailPage" id="emailPage" value="<?php if(isset($_POST['emailPage'])) { echo $_POST['emailPage']; } ?>" class="page_requiredField page_email textfield<?php $emailError = isset($emailError) ? $emailError : '';if($emailError != '') { echo ' inputError'; } ?>" size="22" tabindex="6" />
 </p>
 <label class="textfield_label" for="subjectPage">Subject:</label>
 <p>
  <input type="text" name="subjectPage" id="subjectPage" value="<?php if(isset($_POST['subjectPage'])) { echo $_POST['subjectPage']; } ?>" size="22" tabindex="6" />
 </p>
 <label class="textfield_label" for="commentsPage">Message: *</label>
 <p>
  <textarea name="commentsPage" id="commentsPage" rows="10" cols="36" tabindex="7" class="page_requiredField textarea<?php $commentError = isset($commentError) ? $commentError : '';if($commentError != '') { echo ' inputError';} ?>"><?php if(isset($_POST['commentsPage'])) { if(function_exists('stripslashes')) { echo stripslashes($_POST['commentsPage']); } else { echo $_POST['commentsPage']; } } ?></textarea>
 </p>
 <p class="screenReader">
  <label for="checking" class="screenReader">If you want to submit this form, do not enter anything in this field</label><input type="text" name="checking" id="checking" class="screenReader" value="<?php if(isset($_POST['checking'])) { echo $_POST['checking']; } ?>" />
 </p>
 <p class="loadingImgWidgetFt"></p>
 <p>
  <input type="checkbox" name="option" value="copy"<?php if(isset($_POST['option'])) { echo(' checked'); } ?> />
  <label for="option" class="auto_copy">E-mail a copy of this message to your own address</label>
 </p>

 <?php if(get_option('contact_captcha') == 1) { ?>
 <?php if(get_option('template_style') == 'dark') { $captch_bg = 'black'; } else { $captch_bg = 'white'; } ?>

 <div id="mc">
  <label>Please draw the shape in the box to submit the form: <sup><a onclick="window.location.reload()" href="#reload" title="Click for a new shape" id="refreshCaptcha">New shape</a><sup></label><br /><br />
  <canvas id="mc-canvas" style="background-color: <?php echo $captch_bg;?>"></canvas>
 </div>
 <?php } ?>

 <input name="submittedPage" <?php if(get_option('contact_captcha') == 1) { ?>disabled="disabled" autocomplete="false" <?php } ?>id="submittedPage" class="page_button" tabindex="8" value="<?php if(get_option('button_text') == "") { echo "Send Message"; } else { echo get_option('button_text'); } ?>" type="submit" />
 <input id="submitUrlPage" type="hidden" name="submitUrlPage" value="<?php echo get_template_directory_uri() . '/includes/submit-page.php'; ?>" />
 <input id="emailAddressPage" type="hidden" name="emailAddressPage" value="<?php if(get_option('recipient_email') == "") { bloginfo('admin_email'); } else { echo get_option('recipient_email'); } ?>" />
 <input id="textMessage" type="hidden" name="textMessage" value="<?php if(get_option('subject_message') == "") { echo "Message From Website Contact Form"; } else { echo get_option('subject_message'); } ?>" />
   </form>
   <?php if(get_option('contact_captcha') == 1) {
   if(get_option('third_color')) { $third_color = get_option('third_color');if(get_option('template_style') == 'dark') { $captch_stroke = 'dark'; } else { $captch_stroke = 'light'; } } else {
 if(get_option('template_style') == 'dark') { $third_color = "aaff00";$captch_stroke = 'dark'; } else { $third_color = "6f6f6f";$captch_stroke = 'light'; }
   }
   <script src="<?php echo get_template_directory_uri();?>/scripts/motionCaptcha/motionCaptcha_<?php echo $captch_stroke;?>.js"></script>
   <script type="text/javascript">
 jQuery(document).ready(function(jQuery) {
  jQuery('#contactFormPage').motionCaptcha({
   action: '#submitUrlPage',
   canvasFont: '11px Verdana',
   canvasTextColor: '#<?php echo $third_color;?>',
   shapes: ['triangle', 'x', 'rectangle', 'circle', 'check', 'caret', 'zigzag', 'arrow', 'leftbracket', 'rightbracket', 'v', 'delete', 'star', 'pigtail']
  });
 });
   </script>
   <?php } } ?>
  </div><!-- contact-item end-->
 </div><!-- post end -->
 <?php } } ?>
 <div style="clear:both"></div>
</div><!-- main end -->
<?php get_sidebar();?>
</div><!-- blog end -->
<?php get_footer();?>
Link to comment
https://forums.phpfreaks.com/topic/270850-syntax-error/
Share on other sites

Try,

 

<?php
/*-------------------------------*/
/* Template Name: Contact Page
/*-------------------------------*/
get_header();?>
<div class="blog">
<?php if(get_option('breadcrumbs') == 'yes') { ?>
<div class="blog-info">
 <?php the_breadcrumb();?>
</div>
<?php if(get_option('breadcrumbs_search') != 'no') { get_template_part('search_form'); } } ?>
<div id="main">
 <?php if(have_posts()) { while(have_posts()) { the_post();?>
 <div id="post-<?php the_ID();?>">
  <div class="contact-item">
    <?php if(has_post_thumbnail()) { the_post_thumbnail();?>
    <img src="<?php echo get_template_directory_uri();?>/images/image_shadow_680.png" style="margin-top: -6px" class="semi_trans" />
    <?php } ?>
    <div style="clear:both"></div>
    <div class="post-title" style="margin-bottom: 30px<?php if(has_post_thumbnail()) { ?>;padding-top: 10px<?php } ?>">
	 <?php the_title(); ?>
    </div>
    <div style="clear:both"></div>
    <div class="post-content">
	 <?php the_content();?>
    </div>
    <?php if(get_option('google_map') != '') { ?>
    <div class="google-map">
	 <?php echo stripslashes(get_option('google_map'));?>
    </div>
    <?php }
    //If the form is submitted
    if(isset($_POST['submittedPage'])) { get_template_part('includes/submit-page'); } if(isset($emailSent) && $emailSent == true) { ?>
    <p class="thanks"><?php if(get_option('thankyou_message') != "") { echo get_option("thankyou_message"); } else { ?><strong>Thanks!</strong> Your message has been sent.<?php } ?></p>
    <?php } else { if(isset($captchaError)) { ?>
    <p class="error">There was an error submitting the form.<p>
    <?php } if(get_option('contact_form_title') != '') { ?>
    <h3><?php echo get_option('contact_form_title');?></h3>
    <?php } ?>
    <a name="#reload"></a>
    <form action="<?php the_permalink();?>" id="contactFormPage" method="post">
	 <label class="textfield_label" for="contactNamePage">Name: *</label>
	 <p>
	  <input type="text" name="contactNamePage" id="contactNamePage" value="<?php if(isset($_POST['contactNamePage'])) { echo $_POST['contactNamePage']; } ?>" class="page_requiredField textfield<?php $nameError = isset($nameError) ? $nameError : '';if($nameError != '') { echo ' inputError'; } ?>" size="22" tabindex="5" />
	 </p>
	 <label class="textfield_label" for="emailPage">Email: *</label>
	 <p>
	  <input type="text" name="emailPage" id="emailPage" value="<?php if(isset($_POST['emailPage'])) { echo $_POST['emailPage']; } ?>" class="page_requiredField page_email textfield<?php $emailError = isset($emailError) ? $emailError : '';if($emailError != '') { echo ' inputError'; } ?>" size="22" tabindex="6" />
	 </p>
	 <label class="textfield_label" for="subjectPage">Subject:</label>
	 <p>
	  <input type="text" name="subjectPage" id="subjectPage" value="<?php if(isset($_POST['subjectPage'])) { echo $_POST['subjectPage']; } ?>" size="22" tabindex="6" />
	 </p>
	 <label class="textfield_label" for="commentsPage">Message: *</label>
	 <p>
	  <textarea name="commentsPage" id="commentsPage" rows="10" cols="36" tabindex="7" class="page_requiredField textarea<?php $commentError = isset($commentError) ? $commentError : '';if($commentError != '') { echo ' inputError';} ?>"><?php if(isset($_POST['commentsPage'])) { if(function_exists('stripslashes')) { echo stripslashes($_POST['commentsPage']); } else { echo $_POST['commentsPage']; } } ?></textarea>
	 </p>
	 <p class="screenReader">
	  <label for="checking" class="screenReader">If you want to submit this form, do not enter anything in this field</label><input type="text" name="checking" id="checking" class="screenReader" value="<?php if(isset($_POST['checking'])) { echo $_POST['checking']; } ?>" />
	 </p>
	 <p class="loadingImgWidgetFt"></p>
	 <p>
	  <input type="checkbox" name="option" value="copy"<?php if(isset($_POST['option'])) { echo(' checked'); } ?> />
	  <label for="option" class="auto_copy">E-mail a copy of this message to your own address</label>
	 </p>

	 <?php if(get_option('contact_captcha') == 1) { ?>
	 <?php if(get_option('template_style') == 'dark') { $captch_bg = 'black'; } else { $captch_bg = 'white'; } ?>

	 <div id="mc">
	  <label>Please draw the shape in the box to submit the form: <sup><a onclick="window.location.reload()" href="#reload" title="Click for a new shape" id="refreshCaptcha">New shape</a><sup></label><br /><br />
	  <canvas id="mc-canvas" style="background-color: <?php echo $captch_bg;?>"></canvas>
	 </div>
	 <?php } ?>

	 <input name="submittedPage" <?php if(get_option('contact_captcha') == 1) { ?>disabled="disabled" autocomplete="false" <?php } ?>id="submittedPage" class="page_button" tabindex="8" value="<?php if(get_option('button_text') == "") { echo "Send Message"; } else { echo get_option('button_text'); } ?>" type="submit" />
	 <input id="submitUrlPage" type="hidden" name="submitUrlPage" value="<?php echo get_template_directory_uri() . '/includes/submit-page.php'; ?>" />
	 <input id="emailAddressPage" type="hidden" name="emailAddressPage" value="<?php if(get_option('recipient_email') == "") { bloginfo('admin_email'); } else { echo get_option('recipient_email'); } ?>" />
	 <input id="textMessage" type="hidden" name="textMessage" value="<?php if(get_option('subject_message') == "") { echo "Message From Website Contact Form"; } else { echo get_option('subject_message'); } ?>" />
    </form>
    <?php if(get_option('contact_captcha') == 1) {
    if(get_option('third_color')) { $third_color = get_option('third_color');if(get_option('template_style') == 'dark') { $captch_stroke = 'dark'; } else { $captch_stroke = 'light'; } } else {
	 if(get_option('template_style') == 'dark') { $third_color = "aaff00";$captch_stroke = 'dark'; } else { $third_color = "6f6f6f";$captch_stroke = 'light'; }
    }
    <script src="<?php echo get_template_directory_uri();?>/scripts/motionCaptcha/motionCaptcha_<?php echo $captch_stroke;?>.js"></script>
    <script type="text/javascript">
	 jQuery(document).ready(function(jQuery) {
	  jQuery('#contactFormPage').motionCaptcha({
	   action: '#submitUrlPage',
	   canvasFont: '11px Verdana',
	   canvasTextColor: '#<?php echo $third_color;?>',
	   shapes: ['triangle', 'x', 'rectangle', 'circle', 'check', 'caret', 'zigzag', 'arrow', 'leftbracket', 'rightbracket', 'v', 'delete', 'star', 'pigtail']
	  });
	 });
    </script>
    <?php } } ?>
  </div><!-- contact-item end-->
 </div><!-- post end -->
 <?php } } ?>
 <div style="clear:both"></div>
</div><!-- main end -->
<?php get_sidebar();?>
</div><!-- blog end -->
<?php get_footer();?>

Link to comment
https://forums.phpfreaks.com/topic/270850-syntax-error/#findComment-1393324
Share on other sites

You're missing the closing PHP tag here:

 

</form>
        <?php if(get_option('contact_captcha') == 1) {
        if(get_option('third_color')) { $third_color = get_option('third_color');if(get_option('template_style') == 'dark') { $captch_stroke = 'dark'; } else { $captch_stroke = 'light'; } } else {
         if(get_option('template_style') == 'dark') { $third_color = "aaff00";$captch_stroke = 'dark'; } else { $third_color = "6f6f6f";$captch_stroke = 'light'; }
        }
        <script src="<?php echo get_template_directory_uri();?>/scripts/motionCaptcha/motionCaptcha_<?php echo $captch_stroke;?>.js"></script>

Link to comment
https://forums.phpfreaks.com/topic/270850-syntax-error/#findComment-1393326
Share on other sites

Your code is missing a closing ?> tag on the line right before the line with the error on it, making the inline-html inside of some php code and throwing a php syntax error.

 

That style of coding, in addition to being hard to read, makes it difficult to troubleshoot simple errors, doesn't it?

Link to comment
https://forums.phpfreaks.com/topic/270850-syntax-error/#findComment-1393329
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.