In the Type Formats for an asset, I want to retrieve some information about the Parent asset (i.e. the URL or the asset ID).
In a Group Format you would use something like %parent_url% and depending on the circumstance %globals_asset_url% would normally do the trick.
Some quick info about the asset listing:
It has a dynamic root node set by a GET variable (which rules out %globals_xx_xx% - it will return a reference to the actual asset listing)
It uses Custom Grouping for its display format
I've tried a whole combination of keywords but can't seem to get one to work.
Otherwise the only thing I can think of (apart from using JS) is to nest another asset listing (in the Type Format) which looks up the tree, finds the parent asset and then uses a keyword replacement to display the properties I am after :blink:.
[quote]
Otherwise the only thing I can think of (apart from using JS) is to nest another asset listing (in the Type Format) which looks up the tree, finds the parent asset and then uses a keyword replacement to display the properties I am after :blink:.
[/quote]
At the moment, this is the only way I know of achieving this. We have used this in implementation for quite a while to retrieve the keywords for use on the parent asset.
The only other way I know of doing this would be using the custom grouping list type (as you mentioned earlier). I don't think you've missed anything.
[quote]
At the moment, this is the only way I know of achieving this. We have used this in implementation for quite a while to retrieve the keywords for use on the parent asset.
The only other way I know of doing this would be using the custom grouping list type (as you mentioned earlier). I don't think you've missed anything.
[/quote]
Hi Anthony,
Thanks for the reply, glad I'm not doing something out of the ordinary then.
Everyone wants to print the parent, I know I've wanted to for a while. The feature has been requested a few times. Another option is the metadata route, depending on your configuration…
Problem with having a keyword to print a parent is that an asset can have many parents.
So, what i do ALL the time is set up an asset listing w/ dynamic parameters, restrict the type to the parent asset type, look up the tree w/ direct links turned on. Then nest this where needed, such as a type format or paint layout.
I think the argument for too many parents to print is a bit strange. Surely it would just be a case of setting direct parent, in the same way you set for direct children?
The only keywords that will expose the parent without shenanigans is the %asset_lineage% and %asset_lineage_linked% keywords. I am sure Nic could conjure up some JS that would be able to do dna testing to find out who the real parent is:) Could help while the powers to be dig in on what has been the most logical feature request since cron jobs began.
[quote]
Surely it would just be a case of setting direct parent, in the same way you set for direct children?
[/quote]
You created a spark in my mind. I am now wondering how hard it would be for me to write a new keyword that looks for direct parents, and that we can use any of the normal keyword formats. E.g. %asset_parent_assetid% etc.
[quote]
You created a spark in my mind. I am now wondering how hard it would be for me to write a new keyword that looks for direct parents, and that we can use any of the normal keyword formats. E.g. %asset_parent_assetid% etc.
[/quote]
I've quoted this several times for clients and it never seems that complicated. You just need to accept that the parent you select will always be based on the current URL (i.e., the lineage).
But where it does get complicated is when you don't have a lineage.
The easiest case to think about is a ?a=xxx style URL (used legitimately and extensively by a few installs I've worked with). You can't use the lineage in this case, so you'll need to randomly (??) select one of the asset's parents. It's fine if the asset only has one parent, but I need to consider all cases when putting something into the core product. So what would users expect in this case?
The more complicated case, but more common, is the use of this keyword in listings and nested content. Again, the asset can be determined but the lineage cannot be used. You again need to select a seemingly random parent in this case. The way listings work, for example, is that they would load the asset being listed and ask it for the keyword replacement. The asset would look at the current URL and lineage and get a bit confused. So not only is the keyword quite intensive, it's also inaccurate. When using grouping by parent asset, Matrix figures out the rules based on tree locations and is able to provide parent_* keywords (the full range is available here). And you can't give the keyword a bunch of configuration info because of the negative impact on the performance of the system. You're basically turning the keyword into a dynamic asset listing that way.
The only place I can really see it working easily is that first case and probably via a global keyword. So you have a full URL that points to an asset and the keyword can easily determine the parent based on the current URL. If the asset has two URLs, it might have two parents and show different data at each URL, but that seems ok and caching will handle that fine.
If you guys can come up with solutions for these problems that all users would accept, I don't see any reason why we couldn't add parent keywords. I just don't want to hack something in that works one day but then gives unexpected results the next after someone links an asset in a second location.
[quote]
If you guys can come up with solutions for these problems that all users would accept, I don't see any reason why we couldn't add parent keywords. I just don't want to hack something in that works one day but then gives unexpected results the next after someone links an asset in a second location.
[/quote]
I understand what you mean here Greg. It does sound like it could be tricky for a few of the situation, but easy for others. I might play around with creating a globals parent keyword that would work for normal situations then work on fixing it to work with multiple URLs, nested assets etc.
[quote]
I might play around with creating a globals parent keyword that would work for normal situations then work on fixing it to work with multiple URLs, nested assets etc.
[/quote]
Personally I have a good feeling about the likelihood of your success
I think I added a comment to a similar post a month or two ago - didnt find this post at the time otherwise I'd not have duplicated.
My suggestion to the "multiple parent" challenge that Greg raises would be for the %asset_parent_assetids% (or whatever you called it!) to return a comma separated list of ALL the parent ID's. If you wanted to get fancy you could even consider adding options for the sort of those e.g. %asset_parent_assetids_bydate% _byassetid etc. As a string, comma sep is quite nice as you could pass it down as a replacement root node string for other asset listings. People who knew darned well their site was designed to guarantee there was only one parent could safely add ^as_asset: on the end and get on with it (accepting a null return if their assumption was ever invalid!). To complete the picture, some additional keyword modifiers to pick out the required entry from a comma sep list (e.g. how about %asset_parent_assetids_bydate^csv_last% to get the most recent parent link created for the asset )
Couldn't resist adding the suggestion again, but I wont be holding my breath since clearly this one's been debated quite a bit over the years :)
Well, no asset will have true 'multiple parents' - only linkages, surely? So wherever the asset exists - it will have a parent.... correct? Surely theres a way to render that value to the browser?
Well, no asset will have true 'multiple parents' - only linkages, surely? So wherever the asset exists - it will have a parent.... correct? Surely theres a way to render that value to the browser?
Not sure what you mean by "true multiple parents" but yes, it would just be an asset linked under multiple parents.
It isn't that it can't be done, Matrix has a getParents() function that just returns the parents of an asset.
Well to give you a very rough idea of what I have...
We have standard pages in a folder created as "news articles" - then using an asset listing design, we have a "topic" page (with summaries of all the articles) which then link to the individual articles..
Id like to render out the topic title (the folder the asset is contained in) as a subheading... any suggestions appreciated :)
Well to give you a very rough idea of what I have...
We have standard pages in a folder created as "news articles" - then using an asset listing design, we have a "topic" page (with summaries of all the articles) which then link to the individual articles..
Id like to render out the topic title (the folder the asset is contained in) as a subheading... any suggestions appreciated :)
Have you looked into using the Grouping option of the asset listing? Just use the parent asset to group by, and then choose folder.