Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Hi everyone.

I have spent the better half of my day trying to figure out what I am doing wrong here. I have the tutorial text over and over again but am stuck. I have trying to set up a blog according to the tutorial but I can not get the first post to show. Please take a look at my code and see if there is anything I am missing. I have cleaned up the code to only show the important stuff. I know my code is correct so I just included the relevant tags. Thank you in advance!

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='600' height='200' type='image' />
</cms:template>
<!doctype html>
<html lang="en">

<head>
</head>


<body>

<!--START BLOG CONTENT-->
<div class="container padding">   
         
<img src="<cms:show blog_image />" />
<cms:show blog_content />
         
</div>
<!--END BLOG CONTENT-->


</body>
</html>
<?php COUCH::invoke(); ?>
Hi and welcome to our forums :)

Could you please paste in the entire code that you are using?
The part of the code that you have pasted seems to be ok except that it is not checking for the 'page-view' and the 'list-view' before trying to display the variables.

Even with the code that you have pasted, the inputted content should appear in the page-views (i.e. on the cloned pages).
Try visiting a cloned page from the listing in admin-panel (click the magnifying glass icon on the right). If you can, as you should, see the page being displayed properly then the problem should lie in the code that displays the listing of pages in 'list-view'.
But then I am just guessing. Cannot be certain unless I take a look at the full code.
Hmm, very interesting...If I click the magnifying glass, yes I see the post show up (I only have one post in the backend). Here is the complete code. Thank you very much! I am not familiar with the the page-view and list-view terms.

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='600' height='200' type='image' />
</cms:template>
<!doctype html>
<html lang="en">

<head>
<META http-equiv="Content-type" content="text/html; charset=iso-8859-1">
<link href='http://fonts.googleapis.com/css'family=Arimo:400,700,700italic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css'family=Merienda+One' rel='stylesheet' type='text/css'>
<title>Company Name - We Don't Look Good Unless You Look Great!</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
   
<!-- 1140px Grid styles for IE -->
<!--[if lte IE 9]><link rel="stylesheet" href="css/ie.css" type="text/css" media="screen" /><![endif]-->

<!-- The 1140px Grid - http://cssgrid.net/ -->
<link rel="stylesheet" href="css/1140.css" type="text/css" media="screen" />

<!-- Your styles -->
<link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" />
   
<!--css3-mediaqueries-js - http://code.google.com/p/css3-mediaqueries-js/ - Enables media queries in some unsupported browsers-->
<script type="text/javascript" src="js/css3-mediaqueries.js"></script>
<link href='http://fonts.googleapis.com/css'family=Ubuntu+Condensed|Oswald' rel='stylesheet' type='text/css' />

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="coin-slider/coin-slider.min.js"></script>
<link rel="stylesheet" href="coin-slider/coin-slider-styles.css" type="text/css" />

<script type="text/javascript">
       $(document).ready(function() {
           $('#coin-slider').coinslider({ width: 650, navigation: true, delay: 5000, height: 340 });
       });
</script>
   
<!--Image Rollover-->
<script type="text/javascript">
      $(function() {
         $('img[data-hover]').hover(function() {
            $(this).attr('tmp', $(this).attr('src')).attr('src', $(this).attr('data-hover')).attr('data-hover', $(this).attr('tmp')).removeAttr('tmp');
         }).each(function() {
            $('<img />').attr('src', $(this).attr('data-hover'));
         });;
      });
</script>
<!--End Image Rollover-->
</head>


<body>

<div class="row grad main_bg_color">

   <!--HEADER-->
<div class="container">
<div class="row headerBackground2">
<a href="index.html"><img src="images/logoOff.png" data-hover="images/logo.png" width="240px" height="168px" style="margin-top: 20px; margin-left: 10px;" /></a>
            
               
</div>
</div>
<!--HEADER END-->


<div class="container menu">
<div class="row free">         
<ul>
<li><a href="#">SHOWCASE</a></li>
<li><a href="about.php">ABOUT US</a></li>
<li><a href="blog.php">BLOG</a></li>
<li><a href="contact.php">CONTACT</a></li>            
</ul>                           
</div>
</div>

   <!--START BLOG CONTENT-->
   <div class="container padding">   
      <div class="row">
         
         <!--START COLUMN-->
         <div class="sevencol">
         
         <img src="<cms:show blog_image />" />
         <cms:show blog_content />
         
         </div>
         
         <div class="threecol last">
         </div>
         <!--END COLUMN-->
         
      </div>
   </div>
   <!--END BLOG CONTENT-->

   

</div>
<!--end row-->


</body>
</html>
<?php COUCH::invoke(); ?>
Hi,

OK, so the problem simply is that your code is not handling the 'list-view'.

As to what a 'list-view' is - the concept is simple and applies only to cloned pages i.e. where multiple pages are created of a single template. You said you can see the page when you click on the magnifying glass. Please notice the URL of the page and you'll find it to be something like this - http://www.yoursite.com/blog.php?p=1
where the 'p=1' signifies that it is cloned page number 1. For a URL such as
http://www.yoursite.com/blog.php?p=36
the 'p=36' would signify cloned page number 36. But what happens in the following? -
http://www.yoursite.com/blog.php
You see, there is no 'p=x' here. So the page comes up without any page data. This is the 'list-view'. It is so named because usually you'd want to list all your cloned pages in this view.

Please take a look at http://www.couchcms.com/docs/concepts/cloned-pages.html to know a bit more about the concept.

Coming to your template, this is the part where you display a single post -
Code: Select all
   <!--START BLOG CONTENT-->
   <div class="container padding">   
      <div class="row">
         
         <!--START COLUMN-->
         <div class="sevencol">
         
         <img src="<cms:show blog_image />" />
         <cms:show blog_content />
         
         </div>
         
         <div class="threecol last">
         </div>
         <!--END COLUMN-->
         
      </div>
   </div>
   <!--END BLOG CONTENT-->

Since the variables we are using here become available only in page-view (when a single page is displayed), we should perform a check and display the code only in page-view. if not the page-view (i.e. can only be list-view now) we display a listing of all the pages.
Following is the rectified code -
Code: Select all
   <!--START BLOG CONTENT-->
   <div class="container padding">   
      <cms:if k_is_page >
         <div class="row">
           
            <!--START COLUMN-->
            <div class="sevencol">
           
            <img src="<cms:show blog_image />" />
            <cms:show blog_content />
           
            </div>
           
            <div class="threecol last">
            </div>
            <!--END COLUMN-->
           
         </div>
     
      <cms:else />
     
         <cms:pages limit='10' paginate='1'>
            <div class="row">
               
               <!--START COLUMN-->
               <div class="sevencol">
               
               <img src="<cms:show blog_image />" />
               <cms:show blog_content />
               
               </div>
               
               <div class="threecol last">
               </div>
               <!--END COLUMN-->
               
            </div>   
            <cms:paginator />
         </cms:pages>
         
      </cms:if>
   </div>
   <!--END BLOG CONTENT-->


I suggest you kindly take a cursory look at our tutorial http://www.couchcms.com/docs/tutorials/. You can simply peruse the pages without actually implementing the described site. It should be sufficient to let you know everything that is there to be known about Couch.

Please feel free to contact us if you have any doubts.
Thank you very much for the detailed reply and helping me out. I now understand completely and it is now working. Have spent more time with couch, I have really fallen in love with this system and everything about it. I really hope it continues to develop.
You are welcome and I'm glad I could help :)
6 posts Page 1 of 1