Problems, need help? Have a tip or advice? Post it here.
9 posts Page 1 of 1
Hi, I must be close, but for the love of God, I can't make it work.

I want each folder of a template to have a specific 'mouvements' for each 'artiste'

So, in reproductions_artiste.php I added
Code: Select all
folder_masterpage='portfolio-folders.php'


I created a portfolio-folders.php page with the tags:
Code: Select all
<cms:editable name='mouvements' type='relation' masterpage='mouvements.php' label='Mouvements'  />


Then from the list view on mouvements.php I tried

Code: Select all
<cms:folders hierarchical='1' include_custom_fields='1' masterpage='reproductions_artiste.php' >
       
        <cms:show mouvements />
       
        <cms:related_pages 'mouvements' >
             <cms:show mouvements />
        </cms:related_pages>
       
        <cms:reverse_related_pages 'mouvements' masterpage='reproductions_artiste.php' >
            <cms:show mouvements />
        </cms:reverse_related_pages>
       
    </cms:folders>     


But nothing seems to work.

The goal being to show the folders having the same 'mouvements' variable in the page view after selecting one mouvement.

Anybody knows what I am doing wrong?

Thanks for your help.
Hi Paolo,

Please give me some time to try and wrap my head around the use-case :)
Will get back.
Hi KK,

Thank you very much.

The fact that you are not sure, is reassuring; it has to be more complicated than I thought.

I have the tags working on a blog, but on page per page basis, like:
This article belongs to the "Hopper" category, if someone clicks on the link, he is redirected to a page where all the "Hopper" tagged pages are displayed.
I thought it would be simple to do it with folders instead of pages, but I can't figure it out.

Anyway, thanks again.
Have a wonderful day,
Paolo
:D
Paolo, honestly I still am not clear on what exactly you are trying to achieve (perhaps you could post some real-world use-cases e.g. this artist is in this folder which is then related to these mouvements so when etc. etc.).

Anyway, as for the following -
The goal being to show the folders having the same 'mouvements' variable in the page view after selecting one mouvement.

- after selecting one mouvement, assuming that leads us to a page-view of mouvements.php template, you can place the following in that page-view to list all folders (the extended pages actually) related to that mouvement page -
Code: Select all
<cms:reverse_related_pages masterpage='portfolio-folders.php' 'mouvements'>
    <a href="<cms:show k_page_link />"><h3><cms:show k_page_title /></h3></a>
</cms:reverse_related_pages>

Both <cms:related_pages> and <cms:reverse_related_pages> insist on being kept in page_views of the page being queried (as we did above). Sometime this is not possible (e.g. in your original code); for such cases, we can use plain <cms:pages> to query directly the masterpage involved (cf "Enhanced cms:pages tag" viewtopic.php?f=5&t=8581) .

For example, you can substitute the code given above with the following and it should fetch exactly the same related pages-
Code: Select all
<cms:pages masterpage='portfolio-folders.php' custom_field="mouvements=<cms:show k_page_name />"  >
    <a href="<cms:show k_page_link />"><h3><cms:show k_page_title /></h3></a>
</cms:pages>

These are only pointers.
Please post the exact requirements in more detail, as I requested above, and we can take things forward.
Hi KK,
and thanks for the pointers.

I have a result with it here at https://www.pauloeuvreart.com/mouvements/

BUT I had to use a hack, which is not pretty, like that: (don't laugh!!)

Code: Select all
<cms:if k_is_list>

    <cms:pages masterpage='mouvements.php' >
        <a href="<cms:show k_page_link />"><h3><cms:show k_page_title /></h3></a>
    </cms:pages>
           
<cms:else />
           
    <cms:reverse_related_pages masterpage='portfolio-folders.php' 'mouvements'>
        <a href="<cms:show k_site_link />reproductions_artiste/<cms:php>
        $str = <cms:show k_page_title />;
        $str = strtolower($str);
        echo $str;
        </cms:php>"><h3><cms:show k_page_title /></h3></a>
    </cms:reverse_related_pages>
       
</cms:if>


and it does not work with 'van gogh', which contains a space in the name.

What I really need to do (besides displaying the link to the artists' pages), would be to get the image, name, address of the folders in 'reproductions_artiste.php' that are tagged with each artistic period, named 'mouvements'.
stored in 'peintures.php?o=reproductions_artiste.php&q=list_folders'

I am not sure it's much clear than before, though. Do you see what I am trying to do?

:?

PS: in the homepage I was displaying them with:

Code: Select all
<cms:set my_page="<cms:gpc 'pg' method='get' />" />
    <cms:folders masterpage='reproductions_artiste.php' hierarchical='1' depth='1' order='asc'>
         <cms:set my_folder_image="" />
               <cms:if k_folder_image>
               <cms:set my_folder_image=k_folder_image />
               <cms:else />
               <cms:pages masterpage='reproductions_artiste.php' folder=k_folder_name include_subfolders='0' limit='1'>
               <cms:set my_folder_image=gg_thumb scope='parent' />
               </cms:pages>
               </cms:if>
         
    <div class="itemgrid">
        <a href="<cms:show k_folder_link />">
            <div class="itemgridtitle"><cms:show k_folder_title /><br /><small><cms:show k_folder_totalpagecount /> tableaux</small></div>      
            <amp-img class="contain" width="250" height="250" layout="fill" alt="<cms:show k_folder_title />" src="<cms:show my_folder_image />" ></amp-img>
        </a>
    </div>
</cms:folders>
I think you were close..
The actual folder's name can be derived from the extended-page's title by transforming it using $FUNCS->get_clean_url().
Once we have the folder's name, we can get its full info through <cms:folders> e.g. as follows -
Code: Select all
<cms:reverse_related_pages masterpage='portfolio-folders.php' 'mouvements' skip_custom_fields='1'>
   
    <cms:set my_folder_name="<cms:php>global $FUNCS; echo $FUNCS->get_clean_url( '<cms:show k_page_title />' );</cms:php>" />

    <cms:folders masterpage='reproductions_artiste.php' hierarchical='1' include_custom_fields='1' root=my_folder_name depth='1'>
        <a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a><br />
       
        .. all data pertaining to this folder available here ..
       
    </cms:folders>
</cms:reverse_related_pages>

Does this help?
Yeaaahhhh!!

You bet it helps: everything works as intended!

You're the man!!

A big thanks again, I would never have figured it out by myself...

:D :D :D :D
You are welcome :)
Just to put the use-case in perspective for someone coming across this thread later -

The main template 'reproductions_artiste.php' contains artistic works of various painters as clonable pages.
The artists themselves (e.g. Picasso, Mondrian etc.) have been created as 'folders' of the said template.

There is a second template named 'mouvements.php' that contains various artistic movements (e.g. Mordern Art, Abstract Art etc.) as clonable pages.

The requirement was to relate each artist (i.e. folder of the first template) to various movements (i.e. pages of the second template).
Now, relations can only be established between 'pages' of clonable templates (and not folders) therefore the folders of the first template were fitted in with 'extended folders' (i.e. normal clonable pages that get associated in the background with folders viewtopic.php?f=5&t=8581) using a third template named 'portfolio-folders.php'.

This way the folders (i.e. artists) were indirectly related to movements.

Paolo's use-case was that when someone visited a movement page (e.g. /mouvements/art-abstrait.html), she should be shown a list of all 'artists' that are associated with that movement.

Had the artists been pages, it would have been staple fare to use <cms:reverse_related_pages> to get the related pages from a movement page.

The artists in this case were folders and the entities actually related to the movements were the 'extended-folders' pages of 'portfolio-folders.php'. So we first fetched these 'extended' pages using <cms:reverse_related_pages> -
Code: Select all
<cms:reverse_related_pages masterpage='portfolio-folders.php' 'mouvements' skip_custom_fields='1'>
    ...
</cms:reverse_related_pages>

- and then (in a roundabout way), figured out the names of the actual 'folders' that these extended pages represented (this was possible because the 'title' of the extended pages are always the same as that of the folders) -
Code: Select all
<cms:set my_folder_name="<cms:php>global $FUNCS; echo $FUNCS->get_clean_url( '<cms:show k_page_title />' );</cms:php>" />

With the folder's name in hand, we use <cms:folders> to get to the actual folder's data -
Code: Select all
     <cms:folders masterpage='reproductions_artiste.php' hierarchical='1' include_custom_fields='1' root=my_folder_name depth='1'>
        <a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a><br />
       
        .. all data pertaining to this folder available here ..
       
    </cms:folders>

Hope the explanation helps.
9 posts Page 1 of 1
cron