Problems, need help? Have a tip or advice? Post it here.
15 posts Page 1 of 2
Hello,

My name is Leandro, and i'm developing my own blog with this wonderful CMS. I love how simple it is to create stuff in it.

The only thing it's that i've been having some issues trying to add templates to the CMS so i could add the content there. I'll attach a picture of how it doesn't appear.

Here's the code of the file i'm creating, the filename is index.php:

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

<cms:template title='Blog' clonable='1' commentable='1'>

   <cms:editable name='blog_content' type='richtext' />

   <cms:folder name='Anuncios' title='Anuncios' />
   <cms:folder name='Basurero' title='Basurero' />
   <cms:folder name='Programacion' title='Programaci&oacute;n' />
   <cms:folder name='PHP' title='PHP' />
   <cms:folder name='HTML' title='HTML' />
   <cms:folder name='CSS' title='CSS' />
   <cms:folder name='Javascript' title='Javascript' />
   <cms:folder name='Geek' title='Rincon del Geek' />
   <cms:folder name='popurri' title='Apps y Sitios de Interes' />
</cms:template>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DoctorMalboro - El crack de la internet</title>
<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
<link href="http://fonts.googleapis.com/css?family=Calligraffitti" rel="stylesheet" type="text/css" />
<link href="http://fonts.googleapis.com/css?family=Permanent+Marker" rel="stylesheet" type="text/css" />
<link href="http://fonts.googleapis.com/css?family=Cuprum" rel="stylesheet" type="text/css" />
<link href="http://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet" type="text/css" />
<link href="css/estilo.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="container" id="container">
           <div class="header">DoctorMalboro</div>
              <div class="slogan">El crack de la
                     internet.</div>
               <div class="menu">
                  <ul>
                       <li><a href="index.php">Inicio</a></li>
                     <li><a href="#">Freebies</a></li>
                     <li><a href="#">Modificaciones de SMF</a></li>
                     <li><a href="registro.php">Registro</a></li>
                     <li><a href="#">Creaci&oacute;n del blog</a></li>
                  </ul>
               </div>
</div>
<div class="body">
         <div class="feed"><img src="img/icons/rss.png" alt="" /> Rss Feed: (TO-DO).</div>
</div>
      <div class="categorias">
            <table>
                    <tr>
                           <th scope="row"><img src="img/icons/book.png" alt="" /> Categor&iacute;as</th>
                    </tr>
                          <cms:folders masterpage='index.php' >
                    <tr>
                            <td><a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a></td>
                    </tr>
                          </cms>
            </table>
      </div>
<div class="contenido">
      <h1 class="titulo"><a href="<cms:show k_page_link />"><cms:show k_page_title /></a></h1>
         <div class="post"><div class="parrafo"><cms:show blog_content /></div></div>
<ul class="info">
            <li class="leermas"><img src="img/icons/book_open.png" alt="" /> Leer M&aacute;s...</li>
               <cms:if k_page_foldertitle>
                   <cms:set_category my_category=k_page_foldertitle />
               <cms:else />
                   <cms:set_category my_category="Sin Categorizar" />
            <li><img src="img/icons/book.png" alt="" /> Categor&iacute;a: <cms:show my_category /></li>
            <li><img src="img/icons/user_comment.png" alt="" /> Autor:</li>
            <li><img src="img/icons/date.png" alt="" /> Fecha de Creaci&oacute;n: <cms:show k_page_date format="jS M, y" /></li>
</ul>
      <div class="comentarios"><img src="img/Comment-64.png" alt="" /></div>
            <div class="cantcomentarios"><cms:show k_comment_count /></div>
</div>

<div class="footer"><div class="entradas"><img src="img/icons/arrow_left.png" alt="" /> Entradas antiguas</div></div>

<div class="copyright">
            Creado Por <a href="www.doctormalboro.in" target="_blank">Leandro Poblet</a>. Todos los derechos reservados.<br />
      <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank"><img src="img/icons/css_valid.png" alt="¡Valido para CSS3!" title="¡Válido para CSS3!" /></a>
      <a href="http://validator.w3.org/" target="_blank"><img src="img/icons/html_valid.png" alt="Valido para HTML5!" title="¡Válido para HTML5!" /></a>
</div>

</body>
</html>

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


What could be the issue?

Thanks and have a nice day!
Hi Leandro
few errors in your script kindly try the following
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:folder name='anuncios' title='Anuncios' />
   <cms:folder name='basurero' title='Basurero' />
   <cms:folder name='programacion' title='Programaci&oacute;n' />
   <cms:folder name='php' title='PHP' />
   <cms:folder name='html' title='HTML' />
   <cms:folder name='css' title='CSS' />
   <cms:folder name='javascript' title='Javascript' />
   <cms:folder name='geek' title='Rincon del Geek' />
   <cms:folder name='popurri' title='Apps y Sitios de Interes' />
</cms:template>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DoctorMalboro - El crack de la internet</title>
<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
<link href="http://fonts.googleapis.com/css?family=Calligraffitti" rel="stylesheet" type="text/css" />
<link href="http://fonts.googleapis.com/css?family=Permanent+Marker" rel="stylesheet" type="text/css" />
<link href="http://fonts.googleapis.com/css?family=Cuprum" rel="stylesheet" type="text/css" />
<link href="http://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet" type="text/css" />
<link href="css/estilo.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="container" id="container">
           <div class="header">DoctorMalboro</div>
              <div class="slogan">El crack de la
                     internet.</div>
               <div class="menu">
                  <ul>
                       <li><a href="index.php">Inicio</a></li>
                     <li><a href="#">Freebies</a></li>
                     <li><a href="#">Modificaciones de SMF</a></li>
                     <li><a href="registro.php">Registro</a></li>
                     <li><a href="#">Creaci&oacute;n del blog</a></li>
                  </ul>
               </div>
</div>
<div class="body">
         <div class="feed"><img src="img/icons/rss.png" alt="" /> Rss Feed: (TO-DO).</div>
</div>
      <div class="categorias">
            <table>
                    <tr>
                           <th scope="row"><img src="img/icons/book.png" alt="" /> Categor&iacute;as</th>
                    </tr>
                          <cms:folders masterpage='index.php' >
                    <tr>
                            <td><a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a></td>
                    </tr>
                          </cms:folders>
            </table>
      </div>
<div class="contenido">
      <h1 class="titulo"><a href="<cms:show k_page_link />"><cms:show k_page_title /></a></h1>
         <div class="post"><div class="parrafo"><cms:show blog_content /></div></div>
<ul class="info">
            <li class="leermas"><img src="img/icons/book_open.png" alt="" /> Leer M&aacute;s...</li>
               <cms:if k_page_foldertitle>
                   <cms:set  my_category=k_page_foldertitle />
               <cms:else />
                   <cms:set my_category="Sin Categorizar" />
               </cms:if>
            <li><img src="img/icons/book.png" alt="" /> Categor&iacute;a: <cms:show my_category /></li>
            <li><img src="img/icons/user_comment.png" alt="" /> Autor:</li>
            <li><img src="img/icons/date.png" alt="" /> Fecha de Creaci&oacute;n: <cms:show k_page_date format="jS M, y" /></li>
</ul>
      <div class="comentarios"><img src="img/Comment-64.png" alt="" /></div>
            <div class="cantcomentarios"><cms:show k_comment_count /></div>
</div>

<div class="footer"><div class="entradas"><img src="img/icons/arrow_left.png" alt="" /> Entradas antiguas</div></div>

<div class="copyright">
            Creado Por <a href="www.doctormalboro.in" target="_blank">Leandro Poblet</a>. Todos los derechos reservados.<br />
      <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank"><img src="img/icons/css_valid.png" alt="¡Valido para CSS3!" title="¡Válido para CSS3!" /></a>
      <a href="http://validator.w3.org/" target="_blank"><img src="img/icons/html_valid.png" alt="Valido para HTML5!" title="¡Válido para HTML5!" /></a>
</div>
</body>
</html>
<?php COUCH::invoke(); ?>


you will see admin panel like this
adm1.PNG
adm1.PNG (64.95 KiB) Viewed 7100 times


kindly go through the code i have made few changes and please remember to assign folders names in lowercase you can assign titles in any case.

hope this will solve your issue

Regards
Thank you a lot!

Now i can edit it perfectly, the thing is that the post don't appear in the front page... what could it be?

Attachments

Hi Leandro

i just tested, the post is appearing on the page see the attachments
fp.png
fp.png (64.05 KiB) Viewed 7092 times

indp.png
indp.png (11.51 KiB) Viewed 7092 times


I suggest you kindly download the Aurelius fully ported in couch
http://www.couchcms.com/docs/code/final.zip

please read and follow
http://www.couchcms.com/docs/tutorials/ ... /blog.html
http://www.couchcms.com/docs/tutorials/ ... log-2.html
i am sure you will get some better understanding.


Regards
ARK
Hi,

Once a template is declared clonable, we need to take into account the 'views' (please see http://www.couchcms.com/docs/concepts/views.html ).
To recap, when we access a cloned page of a template, it is the 'page-view' while when we access the template itself it is the 'list-view'.
The data we enter in the editable regions is naturally associated with a single discrete page and will only be available in 'page-view'. In 'list-view' we normally list out all the cloned pages.

In your code, we were not testing for the views. So when we access a cloned page (e.g. localhost/blog/index.php?p=2), the data of this page from editable regions should be available.
But when we access it in list-view (e.g. localhost/blog/index.php) since it is not a cloned page there is no data.

In the following code I have made a slight modification. we test for the views and in list-view we use the 'pages' tag to list all cloned pages of this template. For simplicity I have simply duplicated the HTML used for a single page. In real life you probably would want to display only an excerpt of the pages.
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:folder name='anuncios' title='Anuncios' />
   <cms:folder name='basurero' title='Basurero' />
   <cms:folder name='programacion' title='Programaci&oacute;n' />
   <cms:folder name='php' title='PHP' />
   <cms:folder name='html' title='HTML' />
   <cms:folder name='css' title='CSS' />
   <cms:folder name='javascript' title='Javascript' />
   <cms:folder name='geek' title='Rincon del Geek' />
   <cms:folder name='popurri' title='Apps y Sitios de Interes' />
</cms:template>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DoctorMalboro - El crack de la internet</title>
<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
<link href="http://fonts.googleapis.com/css?family=Calligraffitti" rel="stylesheet" type="text/css" />
<link href="http://fonts.googleapis.com/css?family=Permanent+Marker" rel="stylesheet" type="text/css" />
<link href="http://fonts.googleapis.com/css?family=Cuprum" rel="stylesheet" type="text/css" />
<link href="http://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet" type="text/css" />
<link href="css/estilo.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div class="container" id="container">
           <div class="header">DoctorMalboro</div>
              <div class="slogan">El crack de la
                     internet.</div>
               <div class="menu">
                  <ul>
                       <li><a href="index.php">Inicio</a></li>
                     <li><a href="#">Freebies</a></li>
                     <li><a href="#">Modificaciones de SMF</a></li>
                     <li><a href="registro.php">Registro</a></li>
                     <li><a href="#">Creaci&oacute;n del blog</a></li>
                  </ul>
               </div>
</div>
<div class="body">
         <div class="feed"><img src="img/icons/rss.png" alt="" /> Rss Feed: (TO-DO).</div>
</div>
      <div class="categorias">
            <table>
                    <tr>
                           <th scope="row"><img src="img/icons/book.png" alt="" /> Categor&iacute;as</th>
                    </tr>
                          <cms:folders masterpage='index.php' >
                    <tr>
                            <td><a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a></td>
                    </tr>
                          </cms:folders>
            </table>
      </div>
    

<div class="contenido">
<cms:if k_is_page>
      <h1 class="titulo"><a href="<cms:show k_page_link />"><cms:show k_page_title /></a></h1>
         <div class="post"><div class="parrafo"><cms:show blog_content /></div></div>
<ul class="info">
            <li class="leermas"><img src="img/icons/book_open.png" alt="" /> Leer M&aacute;s...</li>
               <cms:if k_page_foldertitle>
                   <cms:set  my_category=k_page_foldertitle />
               <cms:else />
                   <cms:set my_category="Sin Categorizar" />
               </cms:if>
            <li><img src="img/icons/book.png" alt="" /> Categor&iacute;a: <cms:show my_category /></li>
            <li><img src="img/icons/user_comment.png" alt="" /> Autor:</li>
            <li><img src="img/icons/date.png" alt="" /> Fecha de Creaci&oacute;n: <cms:show k_page_date format="jS M, y" /></li>
</ul>
      <div class="comentarios"><img src="img/Comment-64.png" alt="" /></div>
            <div class="cantcomentarios"><cms:show k_comment_count /></div>
<cms:else />
   <cms:pages>
      <h1 class="titulo"><a href="<cms:show k_page_link />"><cms:show k_page_title /></a></h1>
         <div class="post"><div class="parrafo"><cms:show blog_content /></div></div>
      <ul class="info">
            <li class="leermas"><img src="img/icons/book_open.png" alt="" /> Leer M&aacute;s...</li>
               <cms:if k_page_foldertitle>
                   <cms:set  my_category=k_page_foldertitle />
               <cms:else />
                   <cms:set my_category="Sin Categorizar" />
               </cms:if>
            <li><img src="img/icons/book.png" alt="" /> Categor&iacute;a: <cms:show my_category /></li>
            <li><img src="img/icons/user_comment.png" alt="" /> Autor:</li>
            <li><img src="img/icons/date.png" alt="" /> Fecha de Creaci&oacute;n: <cms:show k_page_date format="jS M, y" /></li>
      </ul>
      <div class="comentarios"><img src="img/Comment-64.png" alt="" /></div>
            <div class="cantcomentarios"><cms:show k_comment_count /></div>
   </cms:pages>
</cms:if>         
         
         
</div>

<div class="footer"><div class="entradas"><img src="img/icons/arrow_left.png" alt="" /> Entradas antiguas</div></div>

<div class="copyright">
            Creado Por <a href="www.doctormalboro.in" target="_blank">Leandro Poblet</a>. Todos los derechos reservados.<br />
      <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank"><img src="img/icons/css_valid.png" alt="¡Valido para CSS3!" title="¡Válido para CSS3!" /></a>
      <a href="http://validator.w3.org/" target="_blank"><img src="img/icons/html_valid.png" alt="Valido para HTML5!" title="¡Válido para HTML5!" /></a>
</div>
</body>
</html>
<?php COUCH::invoke(); ?>

If you go through http://www.couchcms.com/docs/tutorials/ ... log-2.html where we build a blg, you'll see an example of this

Please let us know it this helped.
Ooh, now i've got the view thingy. So i should create one file that shows the post and other that shows the index?
So i should create one file that shows the post and other that shows the index?

The template will remain the same (index.php in your case). The portion within it that displays a single post and that lists all posts will vary.
For clarity, we can place one or both of these portions as separate files within the 'snippets' folder and only use the 'embed' tag to incorporate them back into the template.

For example, the modified template that I posted previously can be further tweaked like this
Code: Select all
<cms:if k_is_page>
    <cms:embed 'single_post.html' />
<cms:else />
    <cms:embed 'list_posts.html' />
</cms:if>

where 'single_post.html' and 'list_posts.html' are files placed in 'couch/snippets' folder containing relevant portions of code cut from the original template.

If you wish, instead of embedding snippets, you can place all the code for both the views in the template itself (like the way I did in my previous post).

Please go through the step-by-step tutorial
http://www.couchcms.com/docs/tutorials/ ... /blog.html
http://www.couchcms.com/docs/tutorials/ ... log-2.html
and I am sure you'll easily get the hang of things.

Do let us know if you have any difficulties.
Now it's working perfect.

But i have 2 inquiries...

1) I can't call the post author with the CMS functions, that means i have to do it with a db query right?
2) How do i make to cut the post content from the main page so i can add a link that says "Read all..."? The link is there, but i don't know if there's an option to give the post content a limit...
1) I can't call the post author with the CMS functions, that means i have to do it with a db query right?

You can create an editable region of text type, name it author and input the name of the author in it. This then can be outputted like all regular editable regions.

2) How do i make to cut the post content from the main page so i can add a link that says "Read all..."? The link is there, but i don't know if there's an option to give the post content a limit...

You can use the excerptHTML tag. Please see -
http://www.couchcms.com/docs/tags-refer ... thtml.html
Code: Select all
<div class="contenido">
<cms:if k_is_page>
      <h1 class="titulo"><a href="<cms:show k_page_link />"><cms:show k_page_title /></a></h1>
         <div class="post"><div class="parrafo"><cms:show content /></div></div>
<cms:else />
<cms:excerptHTML count='130'>
    <cms:show content />
</cms:excerptHTML>
</cms:if>


I'm using this, and it doesn't seem to work... anything wrong? I'm trying not to be cut in the links too... but then it doesn't cut anything.
15 posts Page 1 of 2
cron