Iframe and Dynamic Parameters


(Vsterling) #1

I have a paint layout that includes an iframe, which inside the iframe is an asset listing that is displaying files. The root of the asset listing is supposed to be based off of the page they are currently visiting, using the Dynamic Parameters options and the source as the current asset. However, this is not working for the iframe (I do have it working in other instances). My crazy logic says that possibly the Current asset is not being pulled correctly since the asset listing is within an iframe, so in theory, the current asset that is getting passed to the dynamic asset listing is not the actual page you are at, but itself in the iframe.


So the question is: Can an asset listing hold dynamic parameters when not used as nested content, but a link within an iframe? Does it have to be listed as nested content in order for the current asset id to be reassigned? If so, is there a way I can put a nested content of an asset listing in under a source target statement (i.e. "src=%nested_content_thing_goes_here%")? Or is the problem with the iframe and it not recognizing that it is on a different page?



Any help would be greatly appreciated on this and I can try and provide some html code examples if need be!


(Avi Miller) #2

Yes, if you can pass the dynamic root node to the iframe. For example, if you can get your paint layout to paint something like this:

[html]<iframe src="./?a=1234&amp;RootID=568"></iframe>[/html]

(1234 = asset ID of asset listing, 568 = new root node).

You can use the Dynamic Parameters map to use the RootID GET variable instead of the current asset.

(Vsterling) #3

[quote][html]<iframe src="./?a=1234&amp;RootID=568"></iframe>[/html]


(1234 = asset ID of asset listing, 568 = new root node).



You can use the Dynamic Parameters map to use the RootID GET variable instead of the current asset.[/quote]



Avi I think we are on the right track here but I still can't get it to go through. I have set the dynamic parameters of the asset listing to Get Variable Name - RootID and have the paint layout adding the RootID variable, as you listed above. Also if I put in an asset number for the RootID, won't that just pull by that asset number only? How would that allow it to switch folders like a standard dynamic photo gallery would normally? Even if I put in the asset number of a specific folder that contains the correct file types, I still don't get that asset listing to display at all.



This does sound promising and I'm sure I'm just missing that minor detail here now!


(Avi Miller) #4

The Dynamic Parameters all work the same way, they just get their data from different sources. Usually we use something like "Current Asset" so that we automatically list the children of the current asset. In this case, we're telling the Asset Listing to change its root node to the asset ID provided by the GET parameter. The same rules apply -- the dynamic root node needs to be a child of the static root node and everything else. I would test it directly (i.e. outside the paint layout) and make sure you can get just the asset listing working with the GET parameter.

Also, pop something into the No Results bodycopy to make troubleshooting easier.

(Shane Weddell) #5

I can't help but jump in:) it seems that you are just listing files under the currently viewed asset? Why are you using an iframe? The best way to list the files under a page are to include the asset listing by using a nest content div with the dynamic replacement of root node will work nicely this way.


(Shane Weddell) #6

Just re-read your first post again.


I used to do a lot of front end editing setups using asset listings and iframes. The best way i found to do anything like this was to target the same page as the one you are viewing, however you need to use a different url to do it and create a second paint layout to display the listing you want. you can apply different paint layouts based on url in the asset lookup screen. It is very conveluted but will do what you want.


(Avi Miller) #7

Or, you could use the same URL and use the ?SQ_PAINT_LAYOUT_NAME=xxx option to set a user-defined paint layout instead of the default one.

(Raena Armitage) #8

If your rationale for using the iframe is just to get a scrollable box, you could just nest it normally and use CSS' overflow property to make it scrollable.


It seems like it'd be a lot easier than using an iframe, especially when the content you want in your iframe is based on the current page.


(Vsterling) #9

While I'm not at work, I can't test this but will do as soon as I can and let you know.


I am using an iframe on the page due to the layout of the page. It looks like a book in reading layout format. The left side can scroll down quite a bit, while the right side is updated via links on the left side. The right side was originally set up without an iframe (and I know if I just go back to that it would be an easy fix), however as the whole page refreshed, users would lose their place on the left side of the book. So using an iframe allows us to just refresh that right side and not moving the users view around at all.



I'd throw the link out here if it was live so you can see it rather than read my garbled explanation!


(Avi Miller) #10

I can't wait to see it once it is live. :)

(Vsterling) #11

Actually needed to be...
[html]<iframe src="./?a=1234?RootID=568"></iframe>[/html]

And then I replaced RootID with %asset_assetid% and it works like a charm! Release date for this new site is September 23rd and it will be some pretty cool Matrix stuff (imo).

(Vsterling) #12

Okay jumped ahead of myself… like always. The page initially loads up fine, but it looks like it loses the RootID variable whenever I change the page using the result_page addition on the play links.


[html]<a href="./?a=123456?result_page=%asset_position%" target="thewindow">[/html]



Above is an example link used to change the iframe page. I can add the RootID variable in that to make it work, but unfortunately I can't think of a way to change the RootID variable to be dynamic. I can't use the %asset_assetid% keyword in this case as those asset numbers become the assets listed and not the parent asset ID number.



If I could somehow pull the RootID variable from the iframe window… that would work, but don't know how.

…Or if I could have it just display the assets via the RootID variable that would work too, but since the RootID ends up pointing directly at the child assets, it believes they are a parent and does not display them via asset listing.

…Or maybe the POST variable is needed here??



Any more help from the all powerful Avi (or others out there!) would be appreciated. <_<


(Avi Miller) #13

Well, I'd need to know more about where the various Asset IDs come from. Obviously you know the Root ID for the iframe when you initially paint it. Why can't you add that to the links within (what I assume is) the HTML body of the page?

(Vsterling) #14

Well the RootID is being assigned the %asset_assetid% keyword, which works in launching the asset listing page (which is basically a video player) in the iframe. Outside of the iframe is the listing of videos that are to be played, in the iframe, when you click on the link.


I can't add it to the paint layout as the asset listing of the videos to be played are using the nest content div. While the other asset listing was able to be a bit more manipulative of it since it was going in the iframe. Is there a way for me to add the ?RootID=%asset_assetid% to the nested content div? I only have the option to add the asset listing but no place for me to add additional variables like that?



So two asset listings are at work here. One that is pulling the files to be played inside the player, which is in the iframe and uses that RootID to dynamically find the folder of videos. The other is outside of the iframe and is pulling the same files but to display their metadata along with the link to play. The problem is the one outside of the iframe can't pull the RootID variable from the listing within the iframe… or can it? I just didn't think so. I can't recreate the same process to get the RootID variable though as if you use the %asset_assetid% keyword it gives me the assetids for the children and not the parent. I can hardcode the RootID="12345" and it will work… but just for the one, as then it does not recreate new numbers for new folders when switched, and therefore no longer dynamic.



Ideally if I could somehow get the RootID number that is already being generated via the GET dynamic parameter on the other asset listing in the iframe and use it on the problem asset listing of links, things would be jolly good. The overall problem is that the player asset listing is losing the RootID variable when switched via the player link asset listing, using the href code above.


(Avi Miller) #15

I'm suffering from a really bad headache today. I've read that three times and it still doesn't make much sense to me. :frowning: Hopefully it'll make sense to someone less befuddled than I am. Also, I'm off from tomorrow at the International Users Conference, so I don't have much time to look into it either. If you have some time, feel free to send me some login details and I can take a poke around in the Admin Interface perhaps.


(Vsterling) #16

Aye it gives me a head ache too…


The first thing that came to mind (after a good hour or so) was to use javascript to pick up the variable and append it to the url. However I'm javascript petarded. :angry:



If I get approval, we'll set up some way for you guys to poke at it from the admin interface. Thanks!


(Vsterling) #17

I had a dream about the keyword… %root_nodes%… which can be used to recall the parent RootID and solved all my problems… :slight_smile: