Globals_asset_contents in trigger action for standard page


(Warwick Barnes) #1

G'day,

 

Can anyone fill me in on what the keyword replacement %globals_asset_contents% does? Does it display the contents of a standard page?

 

I'd really like to have a trigger that uses the 'Execute Database Query' action to store some information about a page in a separate database when the page is updated. This would give me an archive of page contents.

 

The trigger works ok for keyword replacements such as %asset_name%, but %globals_asset_contents% is blank.

 

My other way of keeping page archives has been to use a 'Call REST Resource' action to trigger a script that gets the page and its associated images, using wget, to store on disk. However I would have liked to use the database option because it's easier to maintain.

 

Does anyone have any suggestions about the use of %globals_asset_contents%, or another way of getting the contents of a standard page, or of producing an archive of page contents?

 

Thanks,

 

Warwick


(Nic Hubbard) #2

%globals_asset_contents% will pull in the contents of an asset, with the paint layout. %globals_asset_contents_raw% will be without the paint layout. If you would like to get the contents of a specific asset, you can do something like %globals_asset_contents_raw:12345% to get the contents for asset # 12345.


(Warwick Barnes) #3

So it sounds as if %globals_asset_contents_raw% is the right thing, but it just doesn't work (using Matrix 4.18.8) in the context of an 'Execute Database Query' trigger action (nor 'Send Email' trigger action) – just returning blank.


(Tim Davison) #4

Try this:

%globals_asset_contents:%asset_assetid%% 

Yeah - I know, it looks like it shouldn't work but it does (anyone from Squiz want to comment - it's a pretty handy feature).

 

We use this in a Send Email trigger action to do exactly what you are doing - provide an archive of any page that gets updated/published.  Not sure how it would go with a DB action, but can't hurt to try.