Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
I've enabled extended folders via this very handy guide (https://www.couchcms.com/docs/extended- ... /post2.htm), and have a working template file (industries.php) that functions for both page content and the folder views (eg. /industry/government/ and /industries/business/).

I've used the extended folders function to create a special folder template (industries-folder.php) to set some category level or "folder" level editable regions which should be displayed on the folder level view.

One of these regions is a landing page link which is a page outside the couch system. I'd like this URL to appear in links on both the folder view, and in a snippet, based on the folder the page is in.

I've defined the editable region in industries-folder.php like this:
Code: Select all
<cms:editable name='content_page_link' label='Content page Button URL' desc='URL for industry landing page' type='text' group='content_page' order='3' />


Here's how I'm using get_custom_field to place the link in the folder view as a simple custom 'breadcrumb' back to the landing page:
Code: Select all
<h3><a href="<cms:get_custom_field 'content_page_link' masterpage='industries-folder.php' />"><cms:show k_folder_title /></a></h3>


And here's how I'm using it in the HTML snippet to display a category based message and URL in the page view:
Code: Select all
<a href="<cms:get_custom_field 'content_page_link' masterpage='industries-folder.php' />"><cms:get_custom_field 'content_page_button' masterpage='industries-folder.php' /></a>




Here's the problem:

The URL I've set in the folder for content_page_link never appears. BUT, the text field content_page_button render just fine, exactly as I've written in the folder settings, and k_folder_title shows just fine in the folder view.

From the documentation, it seems I need to be defining the specific page generated by the Folder manager from the industries-folder.php template, the problem is, I don't know what "k_" variable I need to use to render the correct page.


None of the k_page... tags have worked, and I've hit the wall.

The default slugs for the generated industries-folder pages are generic like folder-9, and it doesn't appear to like it when I change the slugs.

So, am I on the right track here? Any advice appreciated :)
OK, so

Code: Select all
<cms:show content_page_link masterpage='industries-folder.php' />


works on the folder view, but not in the snippet on the page view.

I've added another variable within the industry.php template which does work on the snippet, but ideally I'd like to enumerate these both 'automatically'.
Hi Erin,

As you know, the extended-folder module associates a cloned page (from industries-folder.php in your case) to each folder of the target template (industries.php).

Let us assume the industries.php template has two folders - 'government' and 'business'.
Courtesy the extended-folder module, the 'industries-folder.php' template will now have two cloned pages associated with the two folders of the target template.

The 'names' of these pages are, as you correctly pointed out, rather generic e.g. 'folder-2'. However the 'titles' are exactly the *same* as the folder they are associated with.

That is our clue for directly targeting the cloned-pages (other way, as explained in the docs is through the <cms:folders> tag).

So, suppose we are on a page-view of the industries.php template. Assuming the page we are on is indeed placed within some folder, we can use the following to target the extended-folder cloned page associated with the folder -
Code: Select all
<cms:if k_page_foldername>
    <cms:pages masterpage='industries-folder.php' page_title=k_page_foldertitle limit='1'>
        .. all data from the associated extended-folder page here ..
        <cms:show content_page_link />
        <cms:show content_page_button />
    </cms:pages>
</cms:if>

Please notice how in the code above we are fetching a page from 'industries-folder.php' the title of which is the same as the folder_title of the 'industries.php' page we are on (we are first checking if this page is indeed within a folder).

So that is how you can get data in a page-view.

Let us tackle the folder-view next.
In a folder-view (e.g. when showing 'business'), Couch automatically fetches the associated folder page and makes available its data.
So you may simply use the following and it should work -
Code: Select all
<cms:show content_page_link />
<cms:show content_page_button />

Please test and let me know it helped.
Thanks KK. That did the trick, much appreciated.
4 posts Page 1 of 1

Who is online

In total there are 4 users online :: 0 registered, 0 hidden and 4 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 4 guests