Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
I have been using the Tutorial to get the site working with Couch, and I seem to be struggling with the Blog section.

The individiual pages of the blog (blog.php?=p19) and so forth are all working showing the individual posts as they should, but the blog.php file which should list all the blog entries, is not displaying properly.

When I look at the source of the page, it contains information that isn't even in my blog_list.html file, which is what I believe it should be embedding to display the list.

Where have I gone wrong??
Hi and welcome to our forums :)

Coming to the problem you mentioned - I'll require some more information to understand what is going wrong.
Could you post in (or PM me) your blog templates (blog.php & blog_list.html ) please? Also the generated output that has the extraneous info.

Thanks
I have moved blog_list.html to the snippets folder which was my initial problem, and an over-sight on my part.

Since doing this, the page generated it is blank with the exception of the "Powered by CouchCMS" link.

blog_list.html
Code: Select all
<!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">
<head>

   <!-- Stylesheets -->
   <link rel="stylesheet" href="includes/css/reset.css" />
   <link rel="stylesheet" href="includes/css/styles.css" />
   
   <!-- Scripts -->
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
   <script src="includes/js/jquery.validate.js" type="test/javascript"></script>
   <script type="text/javascript">
      $(document).ready(function(){
         $("#contact_form").validate();
      });
   </script>
   
   <!-- Meta Tags -->
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   
   <!-- Site Title -->
   <title>Blog - Norman Jones: Innocent!</title>
   
</head>

<body>
   <div id="wrapper" class="container_12 clearfix">

            <!-- Text Logo -->
      <h1 id="logo" class="grid_4">Norman Jones:<br />Innocent!</h1>
      
      <!-- Navigation Menu -->
      <ul id="navigation" class="grid_8">
         <li>
            <a href="contact.php"><span class="meta">Get in touch</span><br />Contact Us</a>
         </li>
         <li>
            <a href="bloglist.php"><span class="meta">Latest news</span><br />Blog</a>
         </li>
         <li>
            <a href="about.php"><span class="meta">About Norman</span><br />About</a>
         </li>
         <li>
            <a href="index.php" class="current"><span class="meta">Homepage</span><br />Home</a>
         </li>
      </ul>
      <div class="hr grid_12">&nbsp;</div>
      <div class="clear"></div>
         
      <!-- Caption Line -->
      <h2 class="grid_12 caption clearfix">Our <span>blog</span>, keeping you up-to-date on our latest news.</h2>
      
      <div class="hr grid_12 clearfix">&nbsp;</div>
      
      <!-- Column 1 /Content -->
      <div class="grid_8">
      
         <!-- Blog Post -->
         <cms:pages masterpage='blog.php'
                  folder=k_folder_name
                  start_on=k_archive_date
                  stop_before=k_next_archive_date
                  paginate='1'
                  limit='3' >
                  
            <div class="post">
               <!-- Post Title -->
               <h3 class="title"><a href="<cms:show k_page_link />"><cms:show k_page_title /></a></h3>
               <!-- Post Data -->
               <cms:if k_page_foldertitle >
                  <cms:set my_category=k_page_foldertitle />
               <cms:else />
                  <cms:set my_category='Uncategorised' />
               </cms:if>
               <p class="sub"><a href="#"><cms:show my_category /></a> &bull; <cms:date k_page_date format='jS M, y'/> &bull; <a href="#"><cms:show k_comments_count /> Comments</a></p>
               <div class="hr dotted clearfix">&nbsp;</div>
               <!-- Post Image -->
               <img class="thumb" alt="" src="<cms:show blog_image />" />
               <!-- Post Content -->
               <cms:excerptHTML count='75' ignore='img'><cms:show blog_content /></cms:excerptHTML>
               <!-- Read More Button -->
               <p class="clearfix"><a href="<cms:show k_page_link />" class="button right"> Read More...</a></p>
            </div>
            <div class="hr clearfix">&nbsp;</div>
            
            <cms:if k_paginated_bottom >
               <!-- Blog Navigation -->
               <p class="clearfix">
                  <cms:if k_paginate_link_next >
                     <a href="<cms:show k_paginate_link_next />" class="button float">&lt;&lt; Previous Posts</a>
                  </cms:if>
                  
                  <cms:if k_paginate_link_prev >
                     <a href="<cms:show k_paginate_link_prev />" class="button float right">Newer Posts >></a>
                  </cms:if>
               </p>
            </cms:if>
         
         </cms:pages >

      </div>
      
      <!-- Column 2 / Sidebar -->
      <cms:embed 'blog_sidebar.html' />
      
      <!-- Footer -->
      <p class="grid_12 footer clearfix">
         <span class="float"><b>&copy; Copyright</b> <a href="">Norman Jones</a>. Website by <a href="http://www.vividwebdesignuk.com">Vivid Web Design UK</a></span>
         <a class="float right" href="#">top</a>
      </p>
      
   </div><!--end wrapper-->
</body>
</html>


blog.php
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Blog' clonable='1' commentable='1'>
   <cms:editable name='blog_content' type='richtext' />
   
   <cms:editable name='blog_image'
      crop='1'
      width='610'
      height='150'
      type='image'
   />
   
   <cms:folder name="philosophy" title="Philosophy" />
   <cms:folder name="history" title="History" />
   <cms:folder name="jobs" title="Jobs" />
   <cms:folder name="staff" title="Staff" />
   <cms:folder name="clients" title="Clients" />
   
</cms:template>

<cms:if k_is_page >
<?php include('includes/global/sitestart.php'); ?>
   
   <!-- Meta Tags -->
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   
   <!-- Site Title -->
   <title>Blog - Norman Jones: Innocent!</title>
   
</head>

<body>
   <div id="wrapper" class="container_12 clearfix">

      <?php include('includes/global/header.php'); ?>
         
      <!-- Caption Line -->
      <h2 class="grid_12 caption clearfix">Our <span>blog</span>, keeping you up-to-date on our latest news.</h2>
      
      <div class="hr grid_12 clearfix">&nbsp;</div>
      
      <!-- Column 1 /Content -->
      <div class="grid_8">
         
         <!-- Blog Post -->
         <div class="post">
            <!-- Post Title -->
            <h3 class="title"><a href="<cms:show k_page_link />"><cms:show k_page_title /></a></h3>
            <!-- Post Title -->
            <cms:if k_page_foldertitle >
               <cms:set my_category=k_page_foldertitle />
            <cms:else />
               <cms:set my_category='Uncategorised' />
            </cms:if>
            <p class="sub"><a href="#"><cms:show my_category /></a> &bull; <cms:date k_page_date format='jS M, y'/> &bull; <a href="#"><cms:show k_comments_count /> Comments</a></p>
            <div class="hr dotted clearfix">&nbsp;</div>
            <!-- Post Title -->
            <img class="thumb" src="<cms:show blog_image />" alt=""/>
            <!-- Post Content -->
            <cms:show blog_content />
            <!-- Post Links -->
            <p class="clearfix">
               <a href="<cms:link masterpage='blog.php' />" class="button float" >&lt;&lt; Back to Blog</a>
               <a href="#commentform" class="button float right" >Discuss this post</a>
            </p>
         </div>
         <div class="hr clearfix">&nbsp;</div>
         
         <!-- Comment's List -->
         <h3>Comments</h3>
         <div class="hr dotted clearfix">&nbsp;</div>
         
         <cms:if k_comments_count >
         <ol class="commentlist">
            <cms:comments page_id=k_page_id order='asc' limit='5' paginate='1' >
            <li class="comment">
               <div class="gravatar">
                  <cms:gravatar email="<cms:show k_comment_author_email />" size="60" />
                  <a name="<cms:show k_comment_anchor />">
               </div>
               <div class="comment_content">
                  <div class="clearfix">
                     <cite class="author_name"><a href=""><cms:show k_comment_author /></a></cite>       
                     <div class="comment-meta commentmetadata"><cms:date k_comment_date format='F j, Y'/> at <cms:date k_comment_date format='h:ia'/></a></div>
                  </div>
                  <div class="comment_text">
                     <p><cms:show k_comment /></p>
                  </div>
               </div>
            </li>
            <cms:paginator />
            </cms:comments>
         </ol>
         <cms:else />
            No comments.
         </cms:if>
         
         <div class="hr clearfix">&nbsp;</div>
         
         <!-- Comment Form -->
         <cms:embed 'comments_form.html' />

      </div>
   
      <!-- Column 2 / Sidebar -->
      <cms:embed 'blog_sidebar.html' />
      
<?php include('includes/global/footer.php'); ?>
<cms:else />
   <cms:embed 'blog_list.html' />
</cms:if>

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


If you require any more information, i would be happy to oblige.
Hi,

I recreated the template and snippet on my system by copy-pasting your code and everything is working just as expected (both in page-view as well as list-view).

Wonder if you could get me your site's FTP + Couch creds? I can log in and try to see the problem firsthand, if it is ok with you.
Please PM me the details.

Thanks
Hi,

Thanks for entrusting me with your site's credentials.

I had a look and this is why only a blank page was showing up -
Your blog.php was embedding 'blog_list.html' while the 'couch/snippets' folder (where embedded snippets are searched for by default) had no such file.
There actually was a file named 'bloglist.html' (notice the missing underscore) but no 'blog_list.html'. So I suppose it was a typing mistake.

I renamed file 'bloglist.html' to 'blog_list.html' and immediately the output showed up (well actually what came up was a syntax error but that was another typo in your source code where 'cms:excerptHTML' was typed in as 'cmd:excerptHTML'. Was a simple fix).

Please check and verify.
Many thanks for all the help.

I'm glad it wasn't all that major, and really grateful for the help. Rest assured the site will be going paid for very soon :)

Couch is an excellent CMS, one I will be using much more often.
6 posts Page 1 of 1