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

I worked through the nested page tutorial and it works for the "normal" standalone pages, but the most important thing for creating a editable menu is at last to make the index/home shown. And I dont get it work.
What is the last step? So I have 2 questions: in tutorial you write:
Create a similar pointer-page for the 'blog' section and another one for the 'home' section.

Blog works, but whats about home, this is the former index.php - so I renamed it to home.php and I pointed index.php to http://localhost:8080/ in the 'points to' textbox (prettyURL is off) is this correct?

And second, what must I put here to see the index.php (home) ?
<cms:else />
<!-- List view. Show a listing of pages -->
</cms:if>


thanks for reply
Hi again,

I think I got it - after hours of thinking and 1 more sleeping and again hours and thinking about this in tutorial (Nested Pages (AKA Menu Maker)):
We also know that in 'list-view', we usually list all the cloned pages of the template (we can choose to do any other thing we want to - point is we'll have to handle the view ourselves).

My index.php have a couple of editable regions and so I put at the end of index.php:
Code: Select all
<cms:else />
<cms:embed 'home.php' />
</cms:if>
<?php COUCH::invoke(); ?>


home.php was a copy of my former index.php (home) situated now in 'snippets' folder for embedding but my mistake was, that snippets cannot have editable tags.
So my solution is (hopefully correct):
I create an new site named start.php only with the editable parts I need in the index-page, like:
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
         <!-- 4 boxes  -->
         <div class="col04">
         <!-- box 1  -->
            <cms:editable name='boxen_gruppe1' label='4er-Box 1' type='group' />
               <div class="heading">
                  <h2><cms:editable name='box1_titel_text' label='Titel' group='boxen_gruppe1' type='textarea' order='-1'>Lorem ipsum</cms:editable></h2>
               </div>
               <div class="content">
                  <p><cms:editable name='box1_text' label='Text' group='boxen_gruppe1' type='richtext'>Mo-Fr 8:30-18:00 Uhr</cms:editable></p>
                  <p class="more"><a class="button" href="single.html">weiter</a></p>
               </div>
         </div>
      
      <!-- welcome -->
         <div class="col16">
               <p><cms:editable name='welcome_text' label='wellcome-Text' type='richtext'><span style="color:#cc3333;">welcome!</span><br>blahblahblah......</cms:editable></p>
          </div>

      <!-- other editables -->
      ...
      
<?php COUCH::invoke(); ?>

In this start.php I put a copy of the code of index.php before (now the home.php as snippet) I want to have editable.

And in my home.php, which ist the view of my new index.php, I include this start.php witdh:
Code: Select all
        <cms:pages masterpage='start.php' 
         limit='1' >   


And instead of the editable parts before, I make only the outputs like:
Code: Select all
<h2><cms:show box1_titel_text /></h2>


This solution works for me - but I think it is not that what you mean in tutorial, is it?

For a Couch-newbie I wish you can make the tutorial at this point more detail.

Please let me know, if this is the best solution for the menu - thanks!
Hi,

I think I can understand the confusion you are facing.
I have delved into this part several times in the documentation but, understandably, it is a little hard to grasp, so I'll give it another go -

Suppose a template has some editable regions and we have not yet declared it as 'clonable'. This scenario is straightforward to understand - the template can be accessed by only one URL (e.g. http://www.yoursite.com/yourtemplate.php). You visit the template and the values from all its editable regions are available to you.

The complexity begins once we declare the template as clonable. Now we can create multiple cloned pages of this template and now the template can be accessed with the URLs specific to each cloned page e.g.
http://www.yoursite.com/yourtemplate.php?p=12
http://www.yoursite.com/yourtemplate.php?p=20
etc.
Each of the URLs shown above is different as each represents a different page (shown by the ?p=number).
When you visit any of the above, the editable regions will contain values pertaining to only the specific page being visited, which is obvious.
What is not so obvious is what happens when we visit the older URL (non-cloned) e.g.
http://www.yoursite.com/yourtemplate.php

Actually when a clonable template is accessed this way, the editable regions will have no values because now this URL does not represent a page. Couch calls it a 'view' (home-view to be specific).
Usually we list all the cloned pages in this view but we can any other thing e.g. show text specific only to the home-view here.

This is where your confusion sets in. You wish to show values from editable regions that are specific only to the home-view and the problem is that any editable region defined in the template won't show any value in this view.

The current way of handling this in Couch is to use a separate non-clonable template (commonly named as globals.php) and to define within it the editable regions meant for the home-views etc. (not only for index.php but for all other templates that you might have e.g. products.php, portfolio.php etc.).

In the home-view, we can now retrieve the values from global.php like this:
Code: Select all
<cms:else />
   <!-- List view.  -->
   <cms:get_custom_field 'name_of some_region' masterpage='globals.php' />
</cms:if>

or like this (easier if if there are multiple regions):
Code: Select all
<cms:else />
   <!-- List view.  -->
   <cms:pages masterpage='globals.php' >
        <cms:show 'name_of some_region'  />
        <cms:show 'name_of some_other_region'  />
   </cms:pages>
</cms:if>

This is all there in the Aurelius tutorial.
Anyways, you have (unknowingly perhaps) used the same technique. Instead of globals.php you are using 'start.php' but the idea is the same.

Does this explanation help? Please let me know.
Thanks.
Hi,

and thanks for your explanation.
I understood the rules of cloneable templates until that you pointed out:

Actually when a clonable template is accessed this way, the editable regions will have no values because now this URL does not represent a page. Couch calls it a 'view' (home-view to be specific).
Usually we list all the cloned pages in this view but we can any other thing e.g. show text specific only to the home-view here.


There I missed a better sample in the tutorial (the Aurelius template don´t explain a Menu in this way!) - indeed I understood the submenus but not the index-page himself. What I lacked was the explanation of globals.php (to find on other part of the tut.) in this context of menucreating. For me it was not entirely clear how to handle this if there is not a list. I was closed to giving up.

Anyway I am glad to hear from you, that I am on right way. It´s great with globals.php, I think for users (editors) it is good to find in tree similar named to wanted page, like home.php oder start.php for editables to index.

Your tutorial is very good, I think it´s more my bad english!

I came from other CMS with other solution for making menu, sometimes more automatically - but I like Couch, it´s so lightweight, it´s so simple for editors but still very good! Great work - thanks again!
4 posts Page 1 of 1