Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
hello all, I have a template using dynamic folders. On the Listing page I am showing the folder links plus an ALL link. The ALL link is the default view - i.e. showing a list of all folder contents.

I want to get hold of the folder title - to display next to each item - as a tag/category. But that isn't possible for the ALL listing.

I have previously implemented a function in kfunctions.php in order to override published date with an editable field. So I think this is the route to take but I'm struggling to get to the bottom of how to do this ....

Set up the value of an editable text field - folder_selected - with the value of the folder that has been selected from the dropdown list presented.

Thanks in advance!
Hi @potato,

I am very sorry but I don't think I could get the problem :(

I want to get hold of the folder title - to display next to each item - as a tag/category. But that isn't possible for the ALL listing.
Did you mean you are unable to set a proper link with the 'ALL' option in the list? Or is it something else?
I'd like to take a look at the code you are using to produce the list, please.

Set up the value of an editable text field - folder_selected - with the value of the folder that has been selected from the dropdown list presented.
Not sure how this is related to the problem above. Could you please elaborate exactly what you are trying to accomplish?

Thanks.
Sorry, I'll try and explain ....

My template for now is simply this:
Code: Select all
<cms:template title='NOTES'  clonable='1' dynamic_folders='1' commentable='0' order='80' >

with just a couple of test editables.

The navigation for the NOTES is by folder:
Code: Select all
<cms:folders depth='1' orderby='weight'>
    <li><a  <cms:if current_folder=k_folder_name>class="current" <cms:set current_folder=k_folder_name 'global' /><cms:set current_folder_title=k_folder_title 'global' /></cms:if> href="<cms:show k_folder_link />" > <cms:show k_folder_title /></a></li>
</cms:folders>


But I have also added before the folder links this (in order to have a default listing of all notes.php regardless of the folder):

Code: Select all
<a href="<cms:link 'notes.php' />"<cms:if k_template_name=='notes.php' && k_is_home> class="current"</cms:if>>All</a>


All NOTES will be put into a folder.

I want to append the title of the allocated folder to each NOTE - e.g. NEWS or PROJECT

But when I am in the ALL view I don't have the folder information. So my idea was to have a text field in notes.php which would automatically get set to the folder selected on creating a new NOTE. Then I would know the folder of the NOTE regardless of which view I'm in.

Hopefully that makes it a bit clearer :)
If I understood it correctly, the situation is this -
'notes.php' is a clonable template.
Every cloned page of this template will reside in a folder.
When you list all the cloned-pages you'd also like to show the folder info about each page being listed alongside that page.

Is that right?
If so, the you don't need to do anything special for that.
Every cloned page already carries full info about its folder. Place a <cms:dump /> in a page_view or within <cms:pages> and you should see that the following variables are available -
k_page_folderid
k_page_foldername
k_page_foldertitle
k_page_folderdesc
k_page_folderimage
k_page_folderlink
k_page_folderpagecount
k_page_foldertotalpagecount
k_page_folderparentid
k_page_folderweight

For example, the following listing of notes in the 'home_view' (i.e. the 'ALL' option you have) will show all pages appended with their respective folders -
Code: Select all
<cms:pages masterpage='notes.php' >
   <cms:show k_page_title />  <cms:show k_page_foldertitle /><br />
</cms:pages>

As for the sidebar menu, you can use the following code to markout the current folder (regardless of whether we are in a folder-view or a page-view) -
Code: Select all
<cms:if k_is_folder>
    <cms:set current_folder=k_folder_name 'global' />
<cms:else_if k_is_page />
    <cms:set current_folder=k_page_foldername 'global' />
</cms:if>

<cms:folders depth='1' orderby='weight'>
    <li>
        <a <cms:if current_folder=k_folder_name>class="current"</cms:if> href="<cms:show k_folder_link />" >
            <cms:show k_folder_title />
        </a>
    </li>
</cms:folders>

Does this help or I have (yet again) failed to understand the problem?
Please let me know.
I do apologise - you are of course correct, I must have had a complete blind spot over this - having spent too long looking perhaps and thinking it all far more complicated than it is ... could have sworn that info wasn't available - aaaagh :roll:
5 posts Page 1 of 1