Problems, need help? Have a tip or advice? Post it here.
8 posts Page 1 of 1
I'm new to couch, and so far I've had great success in implementing it into my client's site. Somewhere along the coding process I must have forgotten to close a tag or misused a couch template code.

I know this question has been posed before, and I've checked the following posts for additional information prior to posting here:

http://www.couchcms.com/forum/viewtopic.php?f=4&t=8283

http://www.couchcms.com/forum/viewtopic.php?f=4&t=559

http://www.couchcms.com/forum/viewtopic.php?f=4&p=17597

For whatever reason, I can't seem to find my error, so I'm hoping it's a simple syntax error and someone with fresh eyes can lend a hand.

Please find the broken code below:

Code: Select all
<?php require_once( 'couch/cms.php' ); ?>

<cms:template title='Blog' clonable='1'>
   
<cms:editable
   name='blog_content'
   type='richtext' />
   
   
<cms:editable
      name='blog_date'
      label='Event Date'
      desc='Add Date Day, Month, Year'
      type='text'>1st Jan, 2015</cms:editable>
   
<cms:editable
      name='blog_time'
      label='Event Time'
      desc='Add Time of Event'
      type='text'>12:00 AM/PM to 2:00 AM/PM</cms:editable>
      
<cms:editable
      name='blog_location'
      label='Event Location'
      desc='Add Location'
      type='text'>Name, 123 Street, City</cms:editable>
   
<cms:editable
      name='blog_heading'
      label='Event Heading'
      desc='Add a short description headliner'
      type='text'>The Quick Fox Jumps Over The Fence</cms:editable>
   
   <cms:editable name='blog_image'
      crop='1'
      width='720'
      height='300'
      type='image' />
   
   <cms:editable
      name='thumb'
      label='Image Thumbnail'
      width='90'
      height='90'
      show_preview='1'
      assoc_field='blog_image'
      type='thumbnail' />
</cms:template>

<cms:if k_is_page>
<!DOCTYPE html>
<html lang="en">
  <head>

    <!-- Basic -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <title>XXX</title>
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="description" content="XXX" />
      <meta name="keywords" content="XXX"  />

      <meta name="author" content="XXX">
   
    <!-- Styles -->
    <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,700,800" rel="stylesheet" type="text/css"><!-- Google web fonts -->
    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"><!-- font-awesome -->
    <link href="js/dropdown-menu/dropdown-menu.css" rel="stylesheet" type="text/css"><!-- dropdown-menu -->
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"><!-- Bootstrap -->
    <link href="js/fancybox/jquery.fancybox.css" rel="stylesheet" type="text/css"><!-- Fancybox -->
    <link href="js/audioplayer/audioplayer.css" rel="stylesheet" type="text/css"><!-- Audioplayer -->
    <link href="style.css" rel="stylesheet" type="text/css"><!-- theme styles -->
   
    <!-- Document Text Resizer -->
    <script type="text/javascript" src="js/textsizer.js"></script>

  </head>
 
  <body role="document">
 
    <!-- device test, don't remove. javascript needed! -->
    <span class="visible-xs"></span><span class="visible-sm"></span><span class="visible-md"></span><span class="visible-lg"></span>
    <!-- device test end -->
   

   
   <?php include 'template/header/header.php'; ?>
   
    <div id="k-body"><!-- content wrapper -->
   
       <div class="container"><!-- container -->
   
       <?php include 'template/breadcrumbs/breadcrumbs.php'; ?>
              <div id="resize">
               <div class="row no-gutter"><!-- row -->
                  
                  <!-- Start CouchCMS -->
               
                  <div class="col-lg-8 col-md-8"><!-- doc body wrapper -->
                   
                  <div class="col-padded"><!-- inner custom column -->
                   
                  <h1> Upcoming Events</h1>
                                            
                  <!--EVENT-->
                  <div class="k-article-summary col-lg-12 col-md-12">
                     <a name="4-23-15"></a>
                                <figure class="news-featured-image">   
                                    <a href="<cms:show k_page_link />" title="<cms:show k_page_title />"><img src="<cms:show blog_image />" alt="<cms:show k_page_title />" class="img-responsive" /></a>
                                </figure>
                               
                                <div class="news-title-meta">
                                    <h1 class="page-title"><a href="<cms:show k_page_link />" title="<cms:show k_page_title />"><cms:show k_page_title /></a></h1>
                                    <div class="news-meta">
                                        <span class="news-meta-date"><cms:show blog_date /></span>
                                        <span class="news-meta-category"><cms:show blog_time /></span>
                                        <span class="news-meta-comments"><cms:show blog_location /></span>
                                    </div>
                                </div>
                               
                                <div class="news-body">
                                    <p class="call-out"><cms:show blog_heading /></p>
                              <!-- Content body -->
                              <cms:show blog_content />
                              
                                </div>
                        <!--back to events button -->
                        <br />
                        <p>
                           <a class="btn btn-success btn-md" title="Button" href="<cms:link masterpage='blog.php' />">Back to Events List</a>
                        </p>
                        <!--end button-->
                           
                            </div>
                  <!-- END EVENT -->   
                                   
                  </div><!-- inner custom column end -->
                   
                  </div><!-- doc body wrapper end -->
               
                  
                   <?php include 'template/sidebar/sidebar-1.php'; ?>
                   
               </div><!-- row end -->
            
            </div>
       
      </div><!-- container end -->
   
    </div><!-- content wrapper end -->
   
   <!-- Independent -->
   <?php include 'template/footer/footer.php'; ?>
       <?php include 'template/footer/footer_bottom.php'; ?>
         <?php include 'template/jquery/main.php'; ?>
   
   
  </body>
</html>

<cms:else/>
   <?php include 'blog_list.php'; ?>
   
</cms:if>


<?php COUCH::invoke(); ?>


I'm curious if my php include is causing problems, as I've had limited success implementing the <cms:embed> code into my site. If I remove the include and insert html the page directs properly. If the code for blog_list.php is required, I can append this post to include that as well.

Thank you in advance,

Tyler
Hi Tyler :)

I checked and there is no error in the code that you pasted.
That can only mean that the error is in one of the several php files that you are including.

Most probably it should be <?php include 'blog_list.php'; ?> - this would be immediately clear if you get the error only in list-view and not in page-view.

If that is not the case then to pinpoint the problem file, uncomment each of the include statement one at a time and run the template - the last uncommented statement that resolves the error will be the file to scrutinize.

Hope it helps.
KK,

Thanks for the quick reply. :D

At least I can rule out that piece of code.

I've scoured the remaining code in the blog_list.php include for errors and I'm still coming up empty. If you or another member of the community would be willing to help me out here once again, it would be greatly appreciated. I have included the code from blog_list.php below:

Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Basic -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <title>XXX</title>
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="description" content="XXX"  />

      <meta name="author" content="XXX">
   
    <!-- Styles -->
    <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,700,800" rel="stylesheet" type="text/css"><!-- Google web fonts -->
    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"><!-- font-awesome -->
    <link href="js/dropdown-menu/dropdown-menu.css" rel="stylesheet" type="text/css"><!-- dropdown-menu -->
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"><!-- Bootstrap -->
    <link href="js/fancybox/jquery.fancybox.css" rel="stylesheet" type="text/css"><!-- Fancybox -->
    <link href="js/audioplayer/audioplayer.css" rel="stylesheet" type="text/css"><!-- Audioplayer -->
    <link href="style.css" rel="stylesheet" type="text/css"><!-- theme styles -->
   
    <!-- Document Text Resizer -->
    <script type="text/javascript" src="js/textsizer.js"></script>

  </head>
 
  <body role="document">
 
    <!-- device test, don't remove. javascript needed! -->
    <span class="visible-xs"></span><span class="visible-sm"></span><span class="visible-md"></span><span class="visible-lg"></span>
    <!-- device test end -->
   

   
   <?php include 'template/header/header.php'; ?>
   
    <div id="k-body"><!-- content wrapper -->
   
       <div class="container"><!-- container -->
   
       <?php include 'template/breadcrumbs/breadcrumbs.php'; ?>
              <div id="resize">
               <div class="row no-gutter"><!-- row -->
                  
               <!--COUCH CONTENT -->
               
               
               
                  <div class="col-lg-8 col-md-8"><!-- doc body wrapper -->
                   
                  <div class="col-padded"><!-- inner custom column -->
                  <h1>Upcoming Events</h1>
                    <cms:pages masterpage='blog.php' paginate='1' limit='3' >
                     
                                       
                  <!--EVENT-->
                  <div class="k-article-summary col-lg-12 col-md-12">
                     <a name="4-23-15"></a>
                                <figure class="news-featured-image">   
                                    <a href="<cms:show k_page_link />" title="<cms:show k_page_title />"><img src="<cms:show blog_image />" alt="<cms:show k_page_title />" class="img-responsive" /></a>
                                </figure>
                               
                                <div class="news-title-meta">
                                    <h1 class="page-title"><a href="<cms:show k_page_link />" title="<cms:show k_page_title />"><cms:show k_page_title /></a></h1>
                                    <div class="news-meta">
                                        <span class="news-meta-date"><cms:show blog_date /></span>
                                        <span class="news-meta-category"><cms:show blog_time /></span>
                                        <span class="news-meta-comments"><cms:show blog_location /></span>
                                    </div>
                                </div>
                               
                                <div class="news-body">
                                    <p class="call-out"><cms:show blog_heading /></p>
                              <!-- Content body -->
                              <cms:excerptHTML count='75' ignore='img'><cms:show blog_content /></cms:excerptHTML> <a  class="moretag" title="read more" href="<cms:show k_page_link />">Read More</a>
                              
                                </div>
                           
                            </div>
                  <!-- END EVENT -->
                  
                  
                  <!-- BEGIN PAGINATION -->
                  <cms:if k_paginated_bottom>
                  <div class="row gutter"><!-- row -->
                       
                           <div class="col-lg-12">
                       
                                <ul class="pagination pull-right"><!-- pagination -->
                                    <cms:if k_paginate_link_prev >
                              <li><a href="<cms:show k_paginate_link_prev />">Prev</a></li>
                           </cms:if>
                           
                           <cms:if k_paginate_link_next >
                              <li><a href="<cms:show k_paginate_link_next />">Next</a></li>
                           </cms:if>
                                </ul><!-- pagination end -->
                           
                            </div>
                           
                        </div><!-- row end -->
                  </cms:if>
                  <!-- END PAGINATION -->
                  
                    </cms:pages>
                  
                  </div><!-- inner custom column end -->
                   
                  </div><!-- doc body wrapper end -->
               
               <?php include 'template/sidebar/sidebar-1.php'; ?>
               <!--END COUCH CONTENT -->
                  
                   
                   
               </div><!-- row end -->
            
            </div>
       
      </div><!-- container end -->
   
    </div><!-- content wrapper end -->
   
   <!-- Independent -->
   <?php include 'template/footer/footer.php'; ?>
       <?php include 'template/footer/footer_bottom.php'; ?>
         <?php include 'template/jquery/main.php'; ?>
   
   
  </body>
</html>
<?php COUCH::invoke(); ?>
Couldn't spot any errors in blog_list.php also.
Must be in one of the other include files. Did you try my suggestion of commenting out the include statements one by one till the cms:if error disappears.

Alternatively, if your server is online, please PM me the Couch+FTP creds and I'll can take a look at the site if you so wish.
KK,

Thanks again for all your help. I was able to fix the problem by redirecting to blog_list.php instead of blog.php. Somewhere in there I mixed up where pages should direct, and now the code is functioning as expected.

Very happy :D

Thank you!

Feel free to close this topic.
is there no way to tell which line exactly is causing an issue?
It seems the error line and character which are reported come from a "flat file" that includes all embedded and included files together, hard to follow along with a regular code editor :(

Attachments

---
You live many times, but only ever remember your lives.length - 1
---
Image
cholasimmons wrote: is there no way to tell which line exactly is causing an issue?
It seems the error line and character which are reported come from a "flat file" that includes all embedded and included files together, hard to follow along with a regular code editor :(


Could you display the code around those lines? If your doing an IF command that pulls a page, you have to make sure that page is in the /couch/snippets folder before the embed actually works.
@cholasimmons, I agree - the line info provided with the error is not of much help if there are embeds involved.

Personally, I never make several changes to any template in a single go - I always make incremental changes (add a few tags, check the output. Add a few more. Repeat). That makes it much easier to locate any error spot in case it arises (has to be the last change made).
8 posts Page 1 of 1
cron