Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
Hi,

New to couchcms today. I've been given some code to look at. There is a menu where each items links to a k_folder_link with each individual page listed within.

We'd like to have some of the menu items links directly to content rather than a list of sub-pages. So rather than k_folder_link they would link to k_page_link.

Looking at the template I can the following outputs the menu

Code: Select all
<div id="sidemenu">
  <cms:set current_folder=k_folder_link />
  <cms:folders masterpage='products.php'>
    <li <cms:if "<cms:is_ancestor parent=current_folder child=k_folder_link />" >class="productsnav productsnavlong"<cms:else /> class="productsnav"</cms:if> ><a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a></li>
  </cms:folders>
  </div>


I would like to make the a href link to, I presume, k_page_link in cases where the folder has some text in the description box held in the k_page_folderdesc variable.

Now I've had a search around but I imagine I am missing an easy way to do this.

Would it be something like (pseudocode) :

<cms:if "<cms:k_page-folderdesc>"><a href="<cms:show k_page_link />"</cms:if>
<cms:else><a href="<cms:show k_page_link />" </cms:else>><cms:show k_folder_title /></a>

Thanks in advance for any help.
Hi,

I think we'll need a little more info to understand the problem in its entirety.
Could you please give us some concrete data, for example -
1. what is your folder hierarchy like?
3. for exactly what kind of folders would you want to show the page link?
2. the folder description you mentioned is (as the name suggests) associated with the folder and so will apply to all its child pages. So, out of the possible multiple child pages of a particular folder, which page (k_page_link) would you like to show?

Please let us know. Thanks.
Thanks.

The folder hierarchy is two deep. When click on the menu item it links to page showing a list of thumbnails for all pages contained within the folder. So the <a href> points to a folder - <a href="http://www.thesite.com/products/lamps/">Lamps</a>. This is generated by <a href="<cms:show k_folder_link />">.

When you click on a thumbnail it takes you to the content page for that product containing the text from the description field.

If I change the code dynamically in the browser to point to <a href> points to a folder - <a href="http://www.thesite.com/products/lamps/lamps.html">Lamps</a>. It loads a page containing the content in the description field of that folder. Which is what we want for some of the links.

So some should go to the list of thumbnails, some should just go to the content depending on the menu item.

So I want a way to flag whether a menu item should go to href="http://www.thesite.com/products/lamps/"> or href="http://www.thesite.com/products/lamps/lamps.html".

2 - I would like to show the content in the description field of the folder. Just changing the href to point to lamps/lamps.html rather than lamps works when I change it in the browser. So that's all we need.

3 - For any of the top level folders. Some will point to lists of thumbnails some to the text content. In other words some will link to /lamps/ some to lamps/lamps.html

So a conditional statement in the code to display the menu that point to lamps/lamps.html if the folder description field contains text and to /lamps/ if not would work.

Sorry if that doesn't make sense. I am new to couchcms. I can see the html that needs to change just need to find a way to do it in the cms.
Hi,

Yes, I am beginning to understand it.
Just a few more questions -

By the sample link that you mentioned (http://www.thesite.com/products/lamps/), I assume that the template is 'products.php' and 'lamps' is a top-level folder of the template (the other possibility being that the template is 'index.php' with 'products' and 'lamps' being the folders - but I think this is not what you are using).

Clicking on this link will lead to the 'folder-view' of the template and in this view you are displaying thumbnails of pages contained within the folder.
So, for example, if 'table-lamp' and 'floor-lamp' are two pages within the 'lamp' folder, their thumbnails will be linked to the following URLs (page-views) -
http://www.thesite.com/products/lamps/table-lamp.html
http://www.thesite.com/products/lamps/floor-lamp.html

This is all standard stuff. Now you say that when you click on the following link
http://www.thesite.com/products/lamps/lamps.html
it shows the description of the folder.
This point confuses me. As evident from the URL, 'lamps.html' is actually a cloned page named 'lamps' that is a child of the 'lamp' folder (as illustrated in the example two pages mentioned above).

Now while you can certainly place the folder's description on any page, I think you are making a distinction between the 'lamps.html' page and its other sibling pages (like table-lamp.html or floor-lamp.html) that show their own product data instead of the parent folder's description.
Could you please clarify this point for me?

Finally, you mentioned that some folders should link to the list of thumbnails (i.e. standard folder-view) while some should link to a child-page. This certainly can be done but could you please let me know the criteria you use to decide which of the two types of links to use?
I mean, how do you decide that this folder should show the thumbnails while that one should link to a page?
It is only when we are clear about the condition that we can code it down.

Sorry for all these questions but it was necessary :)
Thanks.
4 posts Page 1 of 1