Problems, need help? Have a tip or advice? Post it here.
19 posts Page 1 of 2
I am having the damnedest time trying to get pages to load the correct content.

Thanks to trendoman's help in another thread, finally got the menu structure displaying perfectly in the front end.

So, I have my index.php which is also my home page and I have the following at the top:
Code: Select all
<cms:template title='Home' order='1' clonable='1' nested_pages='1' >


followed by many editable regions.

Here is a screenshot showing the structure of the index.php after I made all the pages to complete the structure.
CouchCMS_-_Simple_Open-Source_Content_Management___Admin_Panel.png
CouchCMS_-_Simple_Open-Source_Content_Management___Admin_Panel.png (53.8 KiB) Viewed 3954 times


The Home points (redirects) to the http://www.domain.com
The About points to the http://www.domain.com/about.php

Here is a screenshot showing the About page in index.php advanced view.
CouchCMS_-_Simple_Open-Source_Content_Management___Admin_Panel.png
CouchCMS_-_Simple_Open-Source_Content_Management___Admin_Panel.png (71.84 KiB) Viewed 3954 times



Both have Mark as selected in menu for all pages below this link unchecked.

Here is a screenshot showing the about.php list view.
CouchCMS_-_Simple_Open-Source_Content_Management___Admin_Panel.png
CouchCMS_-_Simple_Open-Source_Content_Management___Admin_Panel.png (27.72 KiB) Viewed 3954 times

Here is a screenshot showing the History page in about.php list view.

I am trying to understand the process of managing the menu structure (using the nested pages I followed from documents for index.php) and then making pages within other templates and "easily" add them to the main menu structure. At this point I do not know if I have a coding issue or I have a user issue (me) doing something wrong within the setup in admin.

Maybe it's me! lol... ugh

Thanks to anyone who can chime in!
Looks like you have 2 history pages.

Home (Nested pages) clonable page - is your first.
About (clonable tempalte) clonable page - is second.

What you might find necessary here is to redirect nested pages to 'normal' pages.

This setting might have misguided you: 'mark as selected for pages below' is for css.. Just adds a class so you can style the parent button as 'selected'.

Good luck )
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
trendoman wrote: Looks like you have 2 history pages.

Home (Nested pages) clonable page - is your first.
About (clonable tempalte) clonable page - is second.

What you might find necessary here is to redirect nested pages to 'normal' pages.

This setting might have misguided you: 'mark as selected for pages below' is for css.. Just adds a class so you can style the parent button as 'selected'.

Good luck )


Hello again!

Well yes, and also two Staff and Board pages.

There is one History in the index.php nested_page for the menu structure, then there is one in about.php which History is should use that template and editable regions for that sub item of the about section.

So, if I understand correctly. If a page is made in the about.php - say I make a page in about.php template in cms called Mission Statement. Enter my text and pictures in the editable regions for that template layout. Then I go to the Home (index.php) and add the page there, then point it to the page in the about.php? How do I do that?

I swear, when I understand this I am going to feel like a dummy.
After you created 'real' page and stuffed it with info, you need to create a link in your menu for this page, right?

So, you go to your 'menu template' (nested pages). Create a dummy page there, with the same name as real one. You have mastered this step already :)
Now, what you need is to go to advanced menu of the 'dummy' page and put a direct link to you 'real' page.
The trick here is to find the page link. It is usually shown smth like 'about.php?p=49'.
It can be seen in browser, or in admin panel itself (when mouse hovers over magnifying glass icon).

The problem here is the manual way to create *all* redirects. One by one. No autoupdating, if target is changed.

Does this all answers your question?

Maybe It is me who doesn't understand this concept of menu-making with nested pages.
But it is a pain.

Usually, when there are many clonable pages with folders(!), it is easier to autocreate autoupdatable menu with pages tag (there are examples on forum). This way menu element is output only if a page exists (trivial listing of clonable pages of template with conditionals on folders).

Maybe this manual procedure can be simplified with establishing one-to-one relations between 2 templates and choosing the target page name from a dropdown, without need to see the exact link. But this is overkill. Who would do relations for 5 pages?

This f..ng menu-maker, if I understand correctly, is used for rather simple websites, where nested pages can hold themselves all editables. This use case is very nice for them. No need to do outside templates.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
I tried putting the exact page link into the url, nothing I do pulls up the correct template for that page. Every link loads the homepage. The URLS the menu is generating looks great though...

At this point, I thank you for all your assistance but I have so much time invested and still cannot get this moving in the direction I need to go. Can't build the rest of the site until I get the menu system working for the client to add pages, I can't even get them to work. :(

Ill keep trying a bit more to see if I can figure out what I am doing wrong.. Trendoman thanks again for your time. :)
@john, am I right in understanding that you want the cloned pages of 'about.php' to be automatically included in the menu (i.e. without explicitly adding each page to the menu tree of index.php')?

Please confirm. Thanks.
Honestly, I don't mind if I had to add them into two places at this point. :)

When I chose Couch for this site, it would be the first one that uses a dynamic menu. Most of the sites I built for couch used a one-page style and simple enough that additional pages weren't needed so no clonable templates were needed for page management.

The goal is that when a page is made, the option to have it on the menu or not is available. Normally in Wordpress you would make the page then go to the menu and drop the pages you want in the menu, into the menu. That would be the ideal choice, doesn't have to be drop and drag, but just need to understand how to say This History page that is a sub of the About page loads the about.php template and content associated with that page. Right now I can't get past that. :(

Obviously there will be pages that are part of the menu and pages that are not. So automatically adding may not be the choice? But if there is a way to disable a page from showing in the menu after thats okay.

KK, thanks for responding - the site is not live but rather running off my localhost. I can pm you login information if interested but would rather not post links publicly. :)
KK, If what you have in mind is not purely conditionals to 'embed' listing of about.php, then it is interesting. I hope your solution answers my very similar (actually identical) question. viewtopic.php?f=2&t=9819
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Ok.
Please allow me to explain the 'menu-maker' concept a little here.

Assume index.php is a clonable template. Additionally it is also nestable so its cloned pages can be arranged in an hierarchy.

Anyway, now if we use <cms:nested_pages> tag to list pages from this template, the tag goes through the cloned pages and spits out info about them.
This is just the same as using <cms:pages> except that now it also provides info about the hierarchy.

Point is that <cms:nested_pages> tag can only output info about pages that actually exist as cloned pages of the template (index.php in our example). That is to say, that if a page is not visible in the tree you see for the nested template, it won't/can't be listed using <cms:nested_pages> alone. This should be easy to understand as it cannot possibly list what is not there to begin with.

To understand a second point, let us use <cms:pages> instead of <cms:nested_pages> as you are likely to be more familiar with it.
Take a look at the following code -
Code: Select all
<ul>
<cms:pages masterpage='index.php'>
    <li><a href="<cms:show k_page_link />"><cms:show k_page_title /></a></li>
</cms:pages>
</ul>

It should be easy to see that it is outputting a linear list of pages with links pointing to those pages.
Now suppose we defined a simple text region in the template (say named 'external_link') and use it to input URL of arbitrary pages (on the same site or from elsewhere on the net). Now take a look at the modified version of the code above -
Code: Select all
<ul>
<cms:pages masterpage='index.php'>
    <cms:if external_link >
        <cms:set my_link = external_link>
    <cms:else />
        <cms:set my_link = k_page_link>
    </cms:if>
    <li><a href="<cms:show my_link />"><cms:show k_page_title /></a></li>
</cms:pages>
</ul>

As you can see, we are checking if a cloned page has a value set for the 'external_link' and use it, instead of k_page_link, in the <A> links.
So suppose a cloned page has 'http://www.google.com' set in the text box, the generated link will point to google instead of the page itself.

Basically now that cloned page is acting as a 'pointer page' - a page pointing to some other existing resource on the net.

When you declare a template as 'nestable', this text region that can be used to input a URL gets defined automatically.
So every cloned page of a nestable template can be used as a pointer-page. Which only means that it can store a link to any other resource on the net (it could be on the same site or anywhere).

So the two points that I stressed upon above are -
1. <cms:nested_pages> tag can only output info about pages that actually exist as cloned pages of the template (i.e. are visible in the tree).
2. Each of the above pages is capable of storing URL of any other page (i.e. act as a pointer-page).

With that understood we can finally tackle the problems that are stumping you.
just need to understand how to say This History page that is a sub of the About page loads the about.php template and content associated with that page

In the admin panel you'll see all cloned pages of 'about.php' template listed. The 'history' page would be one of them. If you click on the magnifying glass icon next to the 'history' page, the browser will, of course, show you the history page with all its data. In fact, Couch has loaded "the about.php template and content associated with that page" for you.

Now, following the two points we made just a while back, if we were to create a cloned page of our nestable-template (say named 'History') and make it point to the URL of the page we just visited above, when <cms:nested_pages> lists the cloned pages of index.php, the page named 'History' will simply be pointing to the original 'History' page. This way we have added the history page belonging to 'about.php' in our menu created using 'index.php'.

To reiterate - to add a menu item that points to another page, you have to create a cloned-page and make it point to the other page.

This could have been done with a slicker interface like drag-n-drop but essentially this is what would need to be done.

I hope this has made the concept of menu somewhat clearer.

That said, I agree that it would be chore to add a new page in the menu every time you create a page elsewhere but please consider this -
One is likely to add only a very finite number of pages in the menu (it seems highly unlikely that you'd add all blog posts in the menu).
For templates with large number of cloned-pages, it is usually sufficient to add only a single entry in the menu (e.g. showing 'Blog') that points to the home-view of that template. For templates with smaller number of cloned-pages, it shouldn't be too painful to add a separate menu entry in the tree pointing to the pages that would be visible in the menu.

If, however, you'd really want to 'dynamically' show cloned pages from other template in the menu without manually creating an entry for each, we can do that throwing in a bit of <cms:pages> in the mix. Allow me to explain how.

Suppose you have two templates 'about-us.php' and 'news.php' and you'd want cloned pages of both to appear dynamically in the menu.
To do that create two normal menu entries pointing to the home-views of both templates. Name these two pages 'about-us' and 'news' (please note that these match exactly the names of the two templates except for the '.php' extension). Those were the 'names' - you can set the 'titles' to anything you wish.

Normally you'd use the following code to list pages from the nestable template to create the menu (this is a little simplified for explanation purpose)
Code: Select all
<cms:nested_pages masterpage='index.php' extended_info='1' >
    <cms:if k_level_start ><ul></cms:if>
    <cms:if k_element_start ><li>
        <a href="<cms:show k_menu_link />"><cms:show k_menu_title /></a>
    </cms:if>
    <cms:if k_element_end ></li></cms:if>
    <cms:if k_level_end ></ul></cms:if>
</cms:nested_pages>

The meat of the code above lies in the <cms:if k_element_start > block where we list the actual names of the pages.
We'll make the following changes to that code -
Code: Select all
<cms:if k_element_start ><li>
    <a href="<cms:show k_menu_link />"><cms:show k_menu_title /></a>
    <cms:if k_is_pointer && (k_nestedpage_name='about-us' || k_nestedpage_name='news') >
        <ul>
        <cms:pages masterpage="<cms:show k_nestedpage_name />.php">
            <li><a href="<cms:show k_page_link />"><cms:show k_page_name /></a></li>
        </cms:pages>   
        </ul>
    </cms:if>
</cms:if>

As you can make out, in that block we check if the page being pointed to is either 'about-us' or 'news' and then we introduce a <cms:pages> block to loop through those templates and output their cloned pages.

The technique above can be refined to take folders into consideration too (as @trendoman wanted) and also to dynamically highlight the selected page. Since that is regular coding, I leave that to you.

Of course, the code above would list *all* cloned pages of the two templates. One of your requirement was to allow the user the ability to control which pages shows up in the menu.

To do that, define the following in both the templates (it is important to do so in both) -
Code: Select all
<cms:editable name='my_show_in_menu' label='Show in menu' desc='tick if this page appears in the menu' opt_values='Yes=1' type='checkbox' order='200'
/>

now on each cloned-page of both the templates, you'll see a checkbox that can be set if the page is to be listed in the menu.

On the front-end, our code will now become as follows to take the checkbox into consideration -
Code: Select all
<cms:if k_element_start ><li>
    <a href="<cms:show k_menu_link />"><cms:show k_menu_title /></a>
    <cms:if k_is_pointer && (k_nestedpage_name='about' || k_nestedpage_name='contact') >
        <ul>
        <cms:pages masterpage="<cms:show k_nestedpage_name />.php" custom_field="my_show_in_menu=1">
            <li><a href="<cms:show k_page_link />"><cms:show k_page_name /></a></li>
        </cms:pages>   
        </ul>
    </cms:if>
</cms:if>

It has been a very long post but I sincerely hope it helps.
This long post would serve as an alternative introduction to nested pages concept.

I guess, the beauty lies solely in visual representation of nested pages.
When I have time, I will do a script with db_persist, which enumerates
_all templates,
_all folders within
_all pages
and creates the structure of the website in nested pages (in merely seconds)
I'm sure, this is what I need to forget about any troubles with huge or small menu forever.

ANyway, deleting autogenerated unnecessary pages from menu template is much easier than spending time creating them (with need to figure out names or links). And even maybe I can give user some influence on generating process (maybe exclude some templates or skip pages).

What we need to remember is we should work with normal clonable templates which have no restriction on speed and management.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
19 posts Page 1 of 2
cron