Nested Content Asset Lister

We have a modified simple edit interface that allows users to add pdfs to a page via an Asset Builder Page. The pdf then gets dumped in a Documents folder and added as a child to the
page that was being edited.



The problem I have is trying to implement a "Related Documents" section that comes after the page content; so if there's a pdf (one level below the current page) it'll show it. I've got the nested content customisation in the design and an Asset Lister set up to use the site homepage as root and have played around with direct links and link depth…I either get the pdfs shown on every page or no pdfs shown.



The issue seems to be with the Dynamic Parameters. I set the Replacement Root node for the listing to assetid and found that it uses the asset lister's id. I then set it to Any Super Global, %globals_asset_assetid% expecting it to work as printing out %globals_asset_assetid% in both page contents for the asset lister prints out the page's id correctly.



To sum this up; (1)what is the point of having asset id in Dynamic Parameters when it just uses the Asset Lister's id-is it a bug? and (2) what should/can go in the Any Super Globals box?



Thanks

[quote]
The issue seems to be with the Dynamic Parameters. I set the Replacement Root node for the listing to assetid and found that it uses the asset lister's id. I then set it to Any Super Global, %globals_asset_assetid% expecting it to work as printing out %globals_asset_assetid% in both page contents for the asset lister prints out the page's id correctly.

[/quote]



Did you set the source to current asset? If not, please try this.

I get MySource Warning supplied dynamic root node (id of the Asset Lister) is in an unauthorised part of the system. Defaulting to Static… when I try
Source = Current Asset



"id of the Asset Lister" is not what I want though, I want the id of the page that the asset lister is appearing in.



The reason it is in an unauthorised part of the system, is because I have set the static root node to the website homepage, and the asset lister happens to sit somewhere else (which I think is fine, because I am not interested in children of the asset lister, only children of the page the visitor is viewing)

[quote]
The reason it is in an unauthorised part of the system, is because I have set the static root node to the website homepage, and the asset lister happens to sit somewhere else (which I think is fine, because I am not interested in children of the asset lister, only children of the page the visitor is viewing)

[/quote]



So, the asset that you are trying to list from IS in an authorized part of the system? How are you nesting this asset listing? Just right in your page, or with a paint layout?



There should be no reason why this won't work, and once you set the dynamic parameters to current asset, you do NOT have to change anything else with that section, I would not mess with the keywords.

If you are using a related asset listing you could be suffering some shenanigans courtesy of the related node, etc. How have you set those up? Could you share a bit more of your configuration?

[quote]
If you are using a related asset listing you could be suffering some shenanigans courtesy of the related node, etc. How have you set those up? Could you share a bit more of your configuration?

[/quote]



This is what we've got



(1)In the design



<MySource_AREA id_name="related_docs" design_area="nest_content">

<MySource_SET name="type_codes" value="page file" />

</MySource_AREA>





(2)In the customisation



Nesting content of the Asset Lister

Using arbitrary Paint Layout



(3) The Asset Lister



Asset Types to List-pdf files

Statutes to list-all

Access-read

Exclude Assets-blank

Exclude this asset-no

Root Nodes-topics (the top level page)

Exclude root node-blank

Root Node Logic-must be child of at least ONE root node

Direction-down the tree

min/max depth-currently left blank

Link Types-1 and 2

Link Filtering-no

Customise No results-currently no

Dynamic Parameters -

  • Parameter: Replacement Root node for the listing (must be a child of the static root node),
  • Source: tried various options as mentioned above



    (4)The Asset Lister contents (tried basic debugging)



    RESULTS: %asset_listing% replacement root node id is %globals_asset_assetid%



    NO RESULTS: replacement root node %globals_asset_attribute_assetid% id is %globals_asset_assetid%





    (5)Paint Layout

    <br style='clear: left;'/> <div id="nav-inset"><h3>Related Docs ↓</h3></div><ul>%paint_layout%</ul>



    N.B The s/shot shows what we're after…the Asset Builder allows the editor to put PDFs under the current page (as a child).

    We want the asset lister to list the pdfs that are children of the viewed page.



For a start stop using related listing and use a normal asset listing you do not need to tag anything to achieve this, which I suspect you hadn't been doing anyway. Your debugging will be telling you that you aren't passing the new root node properly so it is time, as Nic mentioned earlier, to stop using keywords for the dynamic replacement and select current asset and then asset id from the drop down. Keywords are going to hurt too much for you now, give them a crack on something else that needs a more complicated setup after you master this. For extra measure set your direct links only to yes then let us know how you got on.

Oh, not sure what the paint layout is achieving as you haven't mentioned the setup of the paint layout. At a guess I would say that your default format fotr your nested listing was <li>lots of cool keywords</li> and you were using the paint layout to add the rest. You do not need to do this if that is the case.


For what it is worth you results in the asset listing could be;

    
    

Related Docs ↓

    %asset_listing%


and no results;
    
Nothing to see here folks, keep moving


Don't forget to take the paint layout setting off the nest.

I think you may be misunderstanding, I have been using an Asset Lister (not Related Asset Lister) to create a "Related Documents" (arbitrary title) block on my page.


When I choose, under Dynamic Parameters, a replacement root node of "Current Asset ID", it gives me the ID of 1622 on every page.



1622 is the ID of the Asset Lister. The Asset Lister doesn't have any children. We don't need the ID of the Asset Lister, there is nothing dynamic about that ID, it's always 1622.



What I do need however is the ID of the page that user is viewing (this page happens to have the design where the Asset Lister is nested). "Current Asset ID" does not return this.



Just for clarification:



  • If I put a document called "Show this" under Business and a document under the Asset Lister called "Never show this".
    [*]I then set the Replacement node as above (to Current Asset ID), since that seems like the obvious solution and was the first thing we tried.
    [*]When I visit the Business page, I see the document "Never show this" (not expected) instead of the document "Show this" (expected).
    [*]Every page shows the "Never show this" document.

Can you please test this on your latest Matrix installation (we are using 3.22.4) and tell me this is not the case? Is it at all possible to get the ID we want?

We are assuming that, by design, the Current Asset ID returns the Current Asset's (ie. the Asset Lister's) ID. This is why we were looking for another variable that would produce the ID of the current page.

If this is not possible, then I would suggest that the current behaviour of the "Current Asset ID" variable in [b]nested[/b] Asset Listers should be changed, as there is nothing dynamic about an ID that always stays the same.

Forgot to mention the Paint Layout, yes it's not doing much. It was just added so that we could tinker with it later.

There is something wrong with either your system or setup as this is a very common use for asset listings. Try nesting the asset listing into the business rates(5) page and if you don't get yet another (0) you have probably got an issue. I will test on 3.22

[quote]
There is something wrong with either your system or setup as this is a very common use for asset listings. Try nesting the asset listing into the business rates(5) page and if you don't get yet another (0) you have probably got an issue. I will test on 3.22

[/quote]



It look very much like the Asset Lister breaks if there is a Paint Layer applied to it. If I take out the Paint Layer it works as expected.

Paint layout will either extend or override the output of your asset listing.

[quote]Forgot to mention the Paint Layout, yes it's not doing much. It was just added so that we could tinker with it later. [/quote]



You either have a bug, or the devil will be in the detail of the paint layout.

[quote]
Paint layout will either extend or override the output of your asset listing.







You either have a bug, or the devil will be in the detail of the paint layout.

[/quote]



I agree - we use asset listings for this type of thing all over the place, and it works perfectly well. I've found that you do have to watch your HTML when using nested assets though, especially in paint layouts. Have you tried having a look at the source of the results page to see what it's actually delivering back? I've been caught out by overlapping <div>s before now… :rolleyes:

In situations like this it is essential to validate your page code as well as run firebug to make sure there are no errors.