GET Variable Not Accessible


(Eddie Leung) #1

Hi,

I have one Asset Listing Page (asset ID: 638168) that accepts a GET parameter called ‘root’. I have a standard page that will query the Asset Listing Page by using:

%globals_asset_contents_raw:638168^with_get:root=16776%
%globals_asset_contents_raw:638168^with_get:root=19953%
%globals_asset_contents_raw:638168%

where 16776 and 19953 are the IDs of the assets to list.

When accessing the Asset List page directly, everything works as expected.

However, when accessing via the standard page, it will only list the result IF I append the GET variable ‘root’ to the URL. E.g.:

http://www.monash.edu/bytes/standard-page?root=16776
http://www.monash.edu/bytes/standard-page?root=19953

In addition, regardless of what value is being passed to the ^with_get: modifier in the standard page, only the assets under the one with the ID being passed in the URL will be returned. For example:

If I access the Standard Page via http://www.monash.edu/bytes/standard-page?root=16776, the assets under 16776 with be printed three times even though I have the three statements below with different (or no) IDs passed to the globals_asset_contents_raw.

%globals_asset_contents_raw:638168^with_get:root=16776%
%globals_asset_contents_raw:638168^with_get:root=19953%
%globals_asset_contents_raw:638168%

If I access the Standard Page via http://www.monash.edu/bytes/standard-page, ‘no result were found’ will be returned.

I tried both %globals_get_root% and %nested_get_root% in the Page Contents and Page Contents (No Result) and they share the same behaviour (i.e. both keyword replacements will ONLY show the ID being passed in the URL)

I have also tried to set up the pages according to this resource but it again has the same behaviour.

I would very much appreciate if anyone can shed some light on that.

With thanks,
Eddie.


(Bart Banda) #2

What version are you on? ^with_get keyword modifier was only added in 5.3.3.0.


(Eddie Leung) #3

Hi Bart,

Many thanks for getting back to me.

That explains it! We are using 5.3.2.1. Since I don’t think we are going to get update anytime soon, I’m wondering if there Is that any alternative that can do something similar?

With thanks,
Eddie.


(Bart Banda) #4

Your other options are to use multiple nested content containers and sending the get parameters that way. Or, use %globals_asset_contents_raw:1234% where 1234 is the REST asst that brings back those assets together as a REST call with ?GET=XXX in the URL requests.

Would any of those work?


(Eddie Leung) #5

Hi Bart,

Thanks for the reply.

By using multiple nested content container together with the session variable list_current_asset_id, I can almost get it working. The only problem is that I need to embed the contents returned by the nested content container in the html code in another container. For example:

Container 1 (in Asset listing 1):
<div>
<p>Some Description...</p>
<ul>
<!-- contents returned by Container 2 goes here -->
</ul>
</div>

Container 2 (nested container created in Asset Listing 2):
<li>Child 1</li>
<li>Child 2</li>

Is that anyway I can achieve that without using ^get?

Update 1: I tried using %globals_asset_contents_raw:652652% where 652652 is the nested container but no result is returned. It seems that the nested container cannot access the list_current_asset_id when being called from %globals_asset_contents_raw:assetId%.

Update 2: I think I managed to get that working by creating an additional container and leave the tags in Container 1 unclosed. For example:

Container 1 (in Asset listing 1):
<div>
<p>Some Description...</p>
<ul>
<!-- contents returned by Container 2 goes here -->

Container 3:
</ul>
</div>

With thanks,
Eddie.