Nesting conditionals - blank assetid


(Hopkinsd1) #1

Hello,

 

I have two data record, a quote and a profile and each have their own metadata schema applied and within each schema there is a name field. The quote schema also has a related asset field, with the intention of relating a profile to a quote.

 

I am trying to create a paint layout that will display a quote and the author and image of the quote will come from the profile data record if the related asset of the quote has been completed otherwise the name and image will come from the quote.

 

The code I have so far is as follows %begin_asset_metadata_quote.profile% %begin_asset_metadata_quote.profile^as_asset:asset_thumbnail_url% %else_asset_metadata_quote.profile^as_asset:asset_thumbnail_url% %end_asset_metadata_quote.profile^as_asset:asset_thumbnail_url%

%asset_metadata_quote.body%

%asset_metadata_quote.profile^as_asset:asset_metadata_profile.firstname% %asset_metadata_quote.profile^as_asset:asset_metadata_profile.lastname%, %asset_metadata_quote.profile^as_asset:asset_metadata_profile.jobtitle% %else_asset_metadata_quote.profile% %begin_asset_thumbnail_url%

%asset_metadata_quote.body%

%asset_metadata_quote.author%, %asset_metadata_quote.source% %else_asset_thumbnail_url%

%asset_metadata_quote.body%

%asset_metadata_quote.author%, %asset_metadata_quote.source% %end_asset_thumbnail_url% %end_asset_metadata_quote.profile%

This all works correctly and the correct image and name get displayed within the quote, however I get a Squiz warning when no related asset on the quote is supplied.

 

The warning is - Assetid, '', provided to as_asset keyword modifier is not valid [CORE0321]

 

I guess its because Squiz translates all the conditionals first before running through them and it cant make "%begin_asset_metadata_quote.profile^as_asset:asset_thumbnail_url%" when no related asset has been set?

 

Is there a way around this?

 

Thanks

David


(Nic Hubbard) #2

Do you mean that you see the error on the front-end? If so, you should turn this option off in System Configuration.


(Hopkinsd1) #3

Hi Nic,

 

Thanks for the reply.

 

Yep I see this warning on the front end. Is it fine to ignore it?

 

Thanks

David


(Nic Hubbard) #4

Yeah, it should be safe to ignore. But make sure when you put your site into production that you turn that option off so that your users don't see errors.