Forum for discussing general topics related to Couch.
6 posts Page 1 of 1
I am slowly losing the will to live trying to use Couch but I so want to use this as a platform for my sites, but it seems unless you are a programmer you have little chance :(

I have gone through the tutorial for shortcodes but there seems to be fundamental stages missing that make it impossible for a non-programmer like me to succeed.

All i want to do is insert a YouTube clip into a page and make it possible for the client to change it in future if required.

Initially I created an editable region and in the relative text box of admin section pasted the iframe code.
This worked, however it displayed the video twice, one on top of the other.

So .. I searched the forums and found that everyone who had asked about YouTube were being told to use shortcodes.
I downloaded a kfunctions.php file that included the YouTube code.
So I followed the tutorial in the documentation and again it didn't work.
In my html source I see the div but nothing at all inside it, no text, no code .. nothing.

After searching post after post I found that a fundamental part of the code was missing .. the cms:do_shortcodes part, pretty important part I think.
So I put this into the page, still doesn't work, no change to my html source :(

I tried a vimeo shortcode kindly supplied by a member .. no change.

After hours of many changes I now get this:
ERROR! Closing tag "do_shortcodes" has no matching opening tag

But it does because my code looks like this:

Code: Select all
<cms:do_shortcodes><cms:show vimeo /></cms:do_shortcodes>


So I went back to the editable region method and now get this:
ERROR! Closing tag "editable" has no matching opening tag

But this is my code:
Code: Select all
<cms:editable name='embed_video' label='Video embed code' type='textarea' no_xss_check='1' /></cms:editable>


Take that line out and the page loads no problem!

Am I missing some other step that the documentation doesn't include?

Is there a simple step by step tutorial that includes ALL the steps needed to include a basic shortcode?

Thinking of just uninstalling this and creating a static site because I'm completely frustrated with it .. please help!

:(
Hello pixelhouse,

I am sorry you are finding the going difficult.
You could have posted the problem on the forums earlier instead of grappling with things alone.

Anyways, let us begin with the current code that you have -
Code: Select all
<cms:editable name='embed_video' label='Video embed code' type='textarea' no_xss_check='1' /></cms:editable>
It has a closing '/' (just after the no_xss_check='1') which is closing off the tag i.e. effectively making it <cms:editable .. />.
So now the closing tag </cms:editable> is redundant and hence the error.

Please remove the spurious '/' from the code and it should work just fine -
Code: Select all
<cms:editable name='embed_video' label='Video embed code' type='textarea' no_xss_check='1' ></cms:editable>
(incidentally, text editors like Notepad++ that highlight tags make it easy to spot such typos).

Please allow me to explain shortcodes a bit more -
You definitely don't have to be a programmer for using them (for example the YouTube or IFrame shortcodes that are in the sample kfunctions.php). Creating a shortcode of your own would be a different matter altogether.

The tutorial at http://www.couchcms.com/docs/miscellane ... codes.html is a step-by-step guide and it does mention the need for using <cms:do_shortcodes> (step 3). Anyways, one can miss noticing things in docs so that is not a problem.

For displaying videos, we have two options -
1. Use textarea with no_xss_check.
2. Use shortcodes.

Shortcodes are necessary only when you want your client to be able to embed videos at any arbitrary location in the content she is inputting (e.g. anywhere within the blog post).

For usecases where there is a fixed location on the template where the video is to be displayed, the textarea method is the best.

You said you tried that the first time and it worked but was displaying the video twice.
Try this - define the editable region at the top of your template with a cms:template block e.g. like this -
Code: Select all
<cms:template>
  <cms:editable name='embed_video' label='Video embed code' type='textarea' no_xss_check='1' ></cms:editable>
</cms:template>

Now place the following where you want the video to appear -
Code: Select all
<cms:show embed_video />

If you'd still prefer to use shortcodes and things don't work, please feel free to post in your code and I am sure it wouldn't take long here before someone tells you what could be wrong in it.

Keep us posted how it goes.

Thanks.
Hi KK,

Thanks for your reply.
I would have replied to my own post last night about an hour later but the post was in the moderation queue so I couldn't.

After much hair loss I did notice the spurious closing tag myself and removed the / and all was well.

I simply copied and pasted that code from another post and just took it for granted that it would be correct, looking back it was a simple error that I should have spotted a mile off earlier but when frustration takes a hold all you see is red mist.

So I used the textarea code and it works perfectly :)
I think previously I may have used the Rich Text code which was likely throwing out the duplicate video.

Not sure how I missed the do_shortcodes part of the documentation, again I can only think that frustration took over so I apologise for that :(

In any case I'm back in love with the concept of Couch and am likely to purchase the pro version for all future sites, and since I will soon have 3 sites on the go it's likely we'll both benefit from your excellent product.

Now onto creating a portfolio/blog style section from the tutorial .. so please expect a big red-headed bald guy having further rants if last night was anything to go by .. not tonight though, I'm still recovering from this incident.

Thanks for your help :)
You are welcome, pixelhouse :)
I am really glad things finally worked out well.

Next time you run into something that baffles you, just post it here on the forum.

Thanks
If there are no objections I will use this topic for almost identical problem. Just started making my own version of "blog" by following tutorial. At one point I went into a little complication. I get an error "ERROR! Tag "if" has no matching closing tag (line: 30 char: 1101)". It happens after putting a following lines in the code:
Code: Select all
<cms:if k_is_page >...
<cms:else />
   <p>Hi! You are seeing the list-view</p>
</cms:if>

If I remove them everything becomes more or less ok.

Full code of the page:

Code: Select all
<?php require_once( 'xxx/cms.php' ); ?>
   <cms:template title='Pagrindinis' clonable='1'>
      <cms:editable name='blog_content' type='richtext' />
   </cms:template>
<cms:if k_is_page >
<!DOCTYPE html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Pagrindinis</title>
<!--[if lt IE 9]>
<script src="script/dist/html5shiv.js"></script>
<![endif]-->
<link rel="stylesheet" href="css/main.css" />
</head>
<body>
<header><a href="index.php" id="logo"></a>
   <nav>
      <ul>
         <li><a href="index.php"><span class="meta">Kas mes?</span><br />Pagrindinis</a></li>
         <li><a href="darbai.php"><span class="meta">Kuo mes užsiimame?</span><br />Projektai</a></li>
         <li><a href="kontaktai.php"><span class="meta">Norite susisiekti?</span><br />Kontaktai</a></li>
      </ul>
</nav>
</header>
<div id="main">
   <div id="content">
      <cms:editable name='Tekstas' type='richtext'></cms:editable>
      <cms:show blog_content />
   </div>
</div>
<footer><div id="copyright"><a href="index.php">© Company name</a></div><div id="CMS"><?php COUCH::invoke(); ?></div></footer>
</body>
</html>
<cms:else />
   <p>Hi! You are seeing the list-view</p>
</cms:if>


Ok, I am working with this project after work and I am usually tired, but I should notice mistake after one or two evenings of looking at the code anyway. But I just can't.
Hi umunas,

The <?php COUCH::invoke(); ?> statement should be the very last line of code in a template.
In your template you have placed it a few lines above from where it is supposed to be.

Please remove the statement from it current position and place it at the very end (i.e. after the </cms:if> and things should work fine.

Thanks.
6 posts Page 1 of 1