Problems, need help? Have a tip or advice? Post it here.
11 posts Page 1 of 2
I’m sure this might be quite basic but I cannot seem to get it. It seems like every example I find about building menus does it from the same template (because the actual nestling can’t be done with multiple templates nestled together? Or?)

My example:

TEMPLATES
I have 3 different templates.
- Startpage (not clonable)
- Category (clonable)
- Detail page (clonable)

SITEMAP
- Home
- Category 1
-- Product 1
-- Product 2
-- Product 3
- Category 2
-- Product 1
-- Product 2
-- …
… and so on

DESIRED URLS:
http://sitename.com/cagegory1/
http://sitename.com/cagegory1/product1
etc.

To achieve the thing I have described above:
- What is best practice when creating categories and products regarding to connecting them together? Relations? How do I connect my products to the right category if they are built with different templates?
- How do I achieve the desired URLs? It seems like the template page always is part for the URL. http://sitename.com/[category]/category1/

Thanks!
Hi and welcome @nebrot,

There can be more than one way to accomplish something with Couch. The standard approach to what you described is to use dynamic folders (docs/concepts/using-folders.html) as the categories. One thing to note - the template name is always reflected in the URL, except when it is index.php. With this in mind, we can use the index.php template and its views (docs/concepts/views.html) like so -

  • home view: home page (sitename.com)
  • folder view: category - listing products (sitename.com/category1/)
  • page view: product details (sitename.com/category1/product1.html)

It would also be trivial to create a menu based on this structure.

Lastly, we can create a hierarchy of templates using nested pages (docs/concepts/nested-pages-aka-menu-maker.html), but this is probably not the most ideal solution for your stated requirements.

Do let us know if you have any further questions.
Thanks for the help!
Hi again,

I'm using dynamic folders and it doesn't seem possible to use spaces or special character (åäö) as "Title" for a folder when trying to make a menu. Why is that?

If I use that the folder lists all kind of pages within it.

If i list the "k_folder_desc" instead it works but then i get the <p> tags in the menu and that is not so great.

Greatful for a tip here!
Hi,

it doesn't seem possible to use spaces or special character (åäö) as "Title" for a folder
That is not correct - the 'Title' supports those characters. It is the 'Name' that does not. I think you are confusing the two.

Please use 'k_folder_name' instead of 'k_folder_title'.
Your right! :D

One last thing. When my template render as startpage or as a folder the regular page properties isnt avalible and i get no page title or meta tags. Is it some how you can set this on a folder view or startpage? Like a general setting?

Thanks
Like a general setting?
Please see the 'Global values' section on the following page of the documentation - http://www.couchcms.com/docs/tutorials/ ... -ends.html

Hope it helps.
Yes found that section!

ok im all good now. All works fine but my template got a bit messy Will break it up with help of partal includes.

thanks for all the help!
KK wrote:
Like a general setting?
Please see the 'Global values' section on the following page of the documentation - http://www.couchcms.com/docs/tutorials/ ... -ends.html

Hope it helps.


Might be a silly question...

Is it possible to check a global value if it is empty before printing it?

Some how using an IF statement around it?

Im using a separate page for globals as below.

<cms:get_custom_field 'site_name' masterpage='globals.php' />
Code: Select all
<cms:if "<cms:get_custom_field 'site_name' masterpage='globals.php' />" >
   <cms:get_custom_field 'site_name' masterpage='globals.php' />
</cms:if>

or to avoid fetching the value twice from the database, use this -
Code: Select all
<cms:set my_value="<cms:get_custom_field 'site_name' masterpage='globals.php' />" />

<cms:if my_value >
    <cms:show my_value />
</cms:if>

Does this help?
11 posts Page 1 of 2