Assets Parent URL


#1

What would be the easiest way to get an asset's parent URL?

 

I considered using a query string to strip the asset name from the end of the URL, but unsure how to apply that to %asset_url%. 

 

Would there be an easier method?

 

Cheers for any wisdom.


(Talk) #2

Hello, here's a couple of common ways I can think of:

 

1. Nest an asset list that lists the parent asset (dynamic root node: current asset, tree direction: up the tree), then in the type format, use %asset_url%.

2. If you're already nesting an asset listing with a single root node: %root_nodes^as_asset:asset_url%.

 

Good luck  :)


(Cgrist) #3

You might need to use an asset listing set to list 'up the tree', to a max-depth of 1, then you can list any attributes of the parent you need. It might be a bit overkill - if you can do something simpler by determining something from the URL. I'm not 100% sure what you mean about your URL method... maybe you need to use %globals_server_query_string% to get the the query string? It can be risky to print any values directly from the query string to your page though...


#4

Hello, here's a couple of common ways I can think of:

 

1. Nest an asset list that lists the parent asset (dynamic root node: current asset, tree direction: up the tree), then in the type format, use %asset_url%.

2. If you're already nesting an asset listing with a single root node: %root_nodes^as_asset:asset_url%.

 

Good luck  :)

 

Cheers Jeremy

 

That response was like lightning...wow!

 

Definitely on the money, but as I'm using a nested asset listing on a standard page with Dynamic Parameters (Current Asset - ID) I guess this will make the above suggestion slightly more complicated.

 

 

 

(Talk) #5

No worries. The nested asset list you already have looking at current asset id should work perfectly with %root_nodes^as_asset:asset_url% in the type format.


#6

You might need to use an asset listing set to list 'up the tree', to a max-depth of 1, then you can list any attributes of the parent you need. It might be a bit overkill - if you can do something simpler by determining something from the URL. I'm not 100% sure what you mean about your URL method... maybe you need to use %globals_server_query_string% to get the the query string? It can be risky to print any values directly from the query string to your page though...

 

Thanks Chris

I'm actually using an asset listing, but due to nesting and dynamic parameters applied is making it rather tricky.


#7

No worries. The nested asset list you already have looking at current asset id should work perfectly with %root_nodes^as_asset:asset_url% in the type format.

 

Thanks, I tried that but it printed the page URL of the asset listing this asset list. I might have to go back to the drawing board.

 

This might explain what I'm trying to achieve:  http://vimeo.com/help/faq

 

In my scenario each of these groups are asset listings displayed on a main FAQ asset listing page.

So "Vimeo Membership" would be one of my asset listings and "Basic Accounts" etc. are the assets listed beneath. As I need these assets (which are questions in my case) to link to the parent (asset listing) and not to themselves (Data Record) is where I'm coming unstuck.

 

Gah! clear as mud I know... hence going for the URL manipulation route.


(Talk) #8

Oh, okay. It’s still possible, if you look at it from the other way 'round. The easiest option looks like the following:
 

Make an asset listing that lists the nodes of the FAQs (i.e. Vimeo Membership, Uploading to Vimeo, etc), then in the type format of that asset listing, nest an asset listing that lists its children (dynamic root node: session variable; list_current_asset_id).

 

Or, you could try turning on asset grouping on the list you already have and group by parent. Then in the group format, use something like:


<h2><a href="%group_url%">%group_name%</a></h2>
<ul>%group_listing%</ul>

(Group URL is a long shot, but group_assetid^as_asset:asset_url should work). If this solution works, a single asset listing asset will handle all your needs.

 

EDIT: Don’t forget to select ‘Custom Grouping’ on the asset listing details screen - spent too long troubleshooting after missing this step!

#9

Cheers Jeremy, Awesome stuff & appreciate your help.


(Talk) #10

No worries, any time  :)


(Tom Chadwin) #11

I don't think either %group_url% or %group_assetid% exist, do they?


(Nic Hubbard) #12

I don't think either %group_url% or %group_assetid% exist, do they?

 

No, they are %parent_url% and %parent_assetid%.


(Tom Chadwin) #13

In which asset types/formats are those valid, Nic? And are they documented?


(Nic Hubbard) #14

In which asset types/formats are those valid, Nic? And are they documented?

 

They work in Group Format bodycopies. If you use the keyword dropdown it will use the parent_* format.

 

The manuals talk about it here: http://manuals.matrix.squizsuite.net/asset-listing/chapters/asset-grouping-screen#Group-Format-Bodycopy

 

You can use any of the standard asset_* keywords but just use parent_* instead.